composer.phar 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384
  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') && ini_get('apc.enable_cli') && ini_get('apc.cache_by_default')) {
  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. define('COMPOSER_DEV_WARNING_TIME', 1525473262);
  23. require 'phar://composer.phar/bin/composer';
  24. __HALT_COMPILER(); ?>
  25. ?’��ì������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.phpþa��îÅ�Zþa��tG�”¶������+���src/Composer/Autoload/ClassMapGenerator.php«��îÅ�Z«��ëÊš¶���������src/Composer/Cache.phpt��îÅ�Zt���&#¶������%���src/Composer/Command/AboutCommand.phpË��îÅ�ZË��º¡Ãh¶������'���src/Composer/Command/ArchiveCommand.phpb��îÅ�Zb��ß:”¶������$���src/Composer/Command/BaseCommand.phpŠ ��îÅ�ZŠ ��r•˶������.���src/Composer/Command/BaseDependencyCommand.phpã��îÅ�Zã��£ ›¶������1���src/Composer/Command/CheckPlatformReqsCommand.phpœ ��îÅ�Zœ ���ÉP¶������*���src/Composer/Command/ClearCacheCommand.php]��îÅ�Z]��‚ß´¶������&���src/Composer/Command/ConfigCommand.php‡H��îÅ�Z‡H��Ä×Ö¶������-���src/Composer/Command/CreateProjectCommand.php;6��îÅ�Z;6��ü€y¶������'���src/Composer/Command/DependsCommand.php·��îÅ�Z·��o±¹ú¶������(���src/Composer/Command/DiagnoseCommand.phpÕG��îÅ�ZÕG��ðõü ¶������,���src/Composer/Command/DumpAutoloadCommand.php
  26. ��îÅ�Z
  27. ��'K¬ž¶������$���src/Composer/Command/ExecCommand.phpi��îÅ�Zi��Eþ€¶������&���src/Composer/Command/GlobalCommand.phpü��îÅ�Zü��ÝH�\¶������$���src/Composer/Command/HomeCommand.phpÃ��îÅ�ZÃ��¯àyB¶������$���src/Composer/Command/InitCommand.php³J��îÅ�Z³J��RU¨‰¶������'���src/Composer/Command/InstallCommand.phpý��îÅ�Zý��0ö:‰¶������(���src/Composer/Command/LicensesCommand.php:��îÅ�Z:��V|›¶������(���src/Composer/Command/OutdatedCommand.php°
  28. ��îÅ�Z°
  29. ��7àzk¶������)���src/Composer/Command/ProhibitsCommand.phpË��îÅ�ZË��g�ð¶������&���src/Composer/Command/RemoveCommand.php›��îÅ�Z›��>Sþ˜¶������'���src/Composer/Command/RequireCommand.phpÖ ��îÅ�ZÖ ��B÷õE¶������)���src/Composer/Command/RunScriptCommand.php‹��îÅ�Z‹��&›7q¶������+���src/Composer/Command/ScriptAliasCommand.phpo��îÅ�Zo�� 5Þl¶������&���src/Composer/Command/SearchCommand.phpã��îÅ�Zã��ñ ¼w¶������*���src/Composer/Command/SelfUpdateCommand.phpÈ2��îÅ�ZÈ2��+}”¶������$���src/Composer/Command/ShowCommand.phpug��îÅ�Zug��ÀÕé¶������&���src/Composer/Command/StatusCommand.php/��îÅ�Z/��ôE_¶������(���src/Composer/Command/SuggestsCommand.php¨ ��îÅ�Z¨ ��¼Ñc¶������&���src/Composer/Command/UpdateCommand.php¯#��îÅ�Z¯#��—ú�T¶������(���src/Composer/Command/ValidateCommand.php#��îÅ�Z#��‰��~¶���������src/Composer/Composer.php#
  30. ��îÅ�Z#
  31. ��UŸP#¶���������src/Composer/Config.phpÅ"��îÅ�ZÅ"��FÅ�¡¶������-���src/Composer/Config/ConfigSourceInterface.php��îÅ�Z��³ [/¶������(���src/Composer/Config/JsonConfigSource.php!��îÅ�Z!��¾S N¶������$���src/Composer/Console/Application.php§3��îÅ�Z§3��‰D;q¶������,���src/Composer/Console/HtmlOutputFormatter.php3��îÅ�Z3��Ú�Eu¶������-���src/Composer/DependencyResolver/Decisions.phpQ��îÅ�ZQ��?˜¬$¶������1���src/Composer/DependencyResolver/DefaultPolicy.php��îÅ�Z��õÝv¶������/���src/Composer/DependencyResolver/GenericRule.php·��îÅ�Z·��Ì~¯³¶������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��îÅ�ZC��´\õ*¶������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��îÅ�Z÷��ïÎà÷¶������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��îÅ�Zý��3#†¶������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���îÅ�ZÓ���Ùâ&ä¶������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��îÅ�Z¹��&¢e
  32. ¶������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��îÅ�ZI��FûÂɶ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phph��îÅ�Zh��öSÕ]¶������3���src/Composer/DependencyResolver/PolicyInterface.php­��îÅ�Z­��Ÿ‹R¶������(���src/Composer/DependencyResolver/Pool.php°"��îÅ�Z°"�� Ž%¶������+���src/Composer/DependencyResolver/Problem.php¥��îÅ�Z¥��@ˆ<4¶������+���src/Composer/DependencyResolver/Request.phpƒ��îÅ�Zƒ��åVP„¶������(���src/Composer/DependencyResolver/Rule.phpÆ��îÅ�ZÆ��Qƒ–ζ������1���src/Composer/DependencyResolver/Rule2Literals.php§��îÅ�Z§��~Ð'ò¶������+���src/Composer/DependencyResolver/RuleSet.phpª
  33. ��îÅ�Zª
  34. ��_΂¶������4���src/Composer/DependencyResolver/RuleSetGenerator.phpL��îÅ�ZL��¡³`¶������3���src/Composer/DependencyResolver/RuleSetIterator.php��îÅ�Z��›Cü$¶������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��îÅ�Zi��hïš,¶������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��îÅ�Zá��‰rôv¶������1���src/Composer/DependencyResolver/RuleWatchNode.phpé��îÅ�Zé��hØÑ´¶������*���src/Composer/DependencyResolver/Solver.phpŸ8��îÅ�ZŸ8��pöb¶������6���src/Composer/DependencyResolver/SolverBugException.php˜��îÅ�Z˜��"qN¶������;���src/Composer/DependencyResolver/SolverProblemsException.phpô��îÅ�Zô��×|Ŧ¶������/���src/Composer/DependencyResolver/Transaction.phpÙ��îÅ�ZÙ��5ÖHÀ¶������-���src/Composer/Downloader/ArchiveDownloader.php³ ��îÅ�Z³ ��ÖðÞŸ¶������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���îÅ�ZÌ���¯à¨¿¶������+���src/Composer/Downloader/DownloadManager.php`��îÅ�Z`��†ë�¾¶������/���src/Composer/Downloader/DownloaderInterface.phpÊ��îÅ�ZÊ��gs!l¶������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���îÅ�ZÑ���&Áœ¿¶������*���src/Composer/Downloader/FileDownloader.php���îÅ�Z���1‚ã¶������/���src/Composer/Downloader/FilesystemException.php
  35. ��îÅ�Z
  36. ��.-‹¶������,���src/Composer/Downloader/FossilDownloader.php` ��îÅ�Z` ��ÿI©u¶������)���src/Composer/Downloader/GitDownloader.php?4��îÅ�Z?4��e�'¶������*���src/Composer/Downloader/GzipDownloader.phpó��îÅ�Zó��}Úo¶������(���src/Composer/Downloader/HgDownloader.php8 ��îÅ�Z8 ��ëyàn¶������*���src/Composer/Downloader/PathDownloader.phpK��îÅ�ZK��9•&c¶������0���src/Composer/Downloader/PearPackageExtractor.phpu��îÅ�Zu��z„‡¶������.���src/Composer/Downloader/PerforceDownloader.php§��îÅ�Z§��⃨¶������*���src/Composer/Downloader/PharDownloader.phpå���îÅ�Zå���ÞÉç¶������)���src/Composer/Downloader/RarDownloader.phpž��îÅ�Zž��6 3U¶������)���src/Composer/Downloader/SvnDownloader.phpH��îÅ�ZH��ùÀF¶������)���src/Composer/Downloader/TarDownloader.phpã���îÅ�Zã���Í’X?¶������.���src/Composer/Downloader/TransportException.php=��îÅ�Z=��ZÎÈÞ¶������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���îÅ�ZÔ���`§ôö¶������)���src/Composer/Downloader/VcsDownloader.php"��îÅ�Z"��œŸp¶������(���src/Composer/Downloader/XzDownloader.php§��îÅ�Z§��W$;á¶������)���src/Composer/Downloader/ZipDownloader.php˜��îÅ�Z˜��›@ü¶������&���src/Composer/EventDispatcher/Event.php ��îÅ�Z ��±™jï¶������0���src/Composer/EventDispatcher/EventDispatcher.phpß0��îÅ�Zß0��}f¶������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���îÅ�Z©���h·0¶������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���îÅ�Zv���wZ8S¶������)���src/Composer/Exception/NoSslException.phpf���îÅ�Zf���ËíM�¶���������src/Composer/Factory.phpR=��îÅ�ZR=��d®¤¶���������src/Composer/IO/BaseIO.phpŒ��îÅ�ZŒ��(‚l‘¶���������src/Composer/IO/BufferIO.php*��îÅ�Z*��¢®hT¶���������src/Composer/IO/ConsoleIO.php‡��îÅ�Z‡��h—tH¶���������src/Composer/IO/IOInterface.phpì��îÅ�Zì���Õ�¶���������src/Composer/IO/NullIO.phpÀ��îÅ�ZÀ��F`sʶ���������src/Composer/Installer.phpXœ��îÅ�ZXœ��éå*¶������*���src/Composer/Installer/BinaryInstaller.phpÛ��îÅ�ZÛ��<x> ¶������2���src/Composer/Installer/BinaryPresenceInterface.phpË���îÅ�ZË���À5š¨¶������.���src/Composer/Installer/InstallationManager.php-��îÅ�Z-��¾}Œ7¶������)���src/Composer/Installer/InstallerEvent.php��îÅ�Z��lÔzi¶������*���src/Composer/Installer/InstallerEvents.phpÞ���îÅ�ZÞ���ìŸ@G¶������-���src/Composer/Installer/InstallerInterface.phpã��îÅ�Zã��^ƒ“ʶ������+���src/Composer/Installer/LibraryInstaller.php^��îÅ�Z^��Ír¶������/���src/Composer/Installer/MetapackageInstaller.phpœ��îÅ�Zœ��ÆÅ!¶������(���src/Composer/Installer/NoopInstaller.php+��îÅ�Z+��À·M}¶������'���src/Composer/Installer/PackageEvent.phpe��îÅ�Ze��;° ¶������(���src/Composer/Installer/PackageEvents.php¸��îÅ�Z¸��dbØs¶������.���src/Composer/Installer/PearBinaryInstaller.phpø ��îÅ�Zø ��*ë•k¶������(���src/Composer/Installer/PearInstaller.php¢��îÅ�Z¢��È‚¶Ñ¶������*���src/Composer/Installer/PluginInstaller.php‹��îÅ�Z‹��ÒX8¶������+���src/Composer/Installer/ProjectInstaller.php��îÅ�Z��*0@P¶������4���src/Composer/Installer/SuggestedPackagesReporter.php��îÅ�Z��+±]Ķ���������src/Composer/Json/JsonFile.phpï��îÅ�Zï��_( ¶������#���src/Composer/Json/JsonFormatter.php��îÅ�Z��Ðqu¶������%���src/Composer/Json/JsonManipulator.php©2��îÅ�Z©2��6æ¬|¶������-���src/Composer/Json/JsonValidationException.php\��îÅ�Z\��.Xóܶ������%���src/Composer/Package/AliasPackage.php��îÅ�Z��¹—~š¶������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��îÅ�Z ��yY+¦¶������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��îÅ�ZÞ�� ²²¹¶������0���src/Composer/Package/Archiver/ArchiveManager.php° ��îÅ�Z° ��gþÒ)¶������3���src/Composer/Package/Archiver/ArchiverInterface.php��îÅ�Z��ñ´> ¶������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��îÅ�Z–��y¶=ƶ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��îÅ�Z��‹SZ0¶������2���src/Composer/Package/Archiver/GitExcludeFilter.phpq��îÅ�Zq��5¾i&¶������1���src/Composer/Package/Archiver/HgExcludeFilter.php ��îÅ�Z �� •¦S¶������.���src/Composer/Package/Archiver/PharArchiver.php>��îÅ�Z>�� 5‰í¶������-���src/Composer/Package/Archiver/ZipArchiver.php¼��îÅ�Z¼��‘XÝë¶������$���src/Composer/Package/BasePackage.php& ��îÅ�Z& ��'ݶ������(���src/Composer/Package/CompletePackage.phpü��îÅ�Zü��þM˶¶������1���src/Composer/Package/CompletePackageInterface.phpõ��îÅ�Zõ��¦Ê�ò¶������+���src/Composer/Package/Dumper/ArrayDumper.phpë ��îÅ�Zë ��Ó8WE¶���������src/Composer/Package/Link.phpˆ��îÅ�Zˆ��å¶Y«¶������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��îÅ�Z‚��é~‹¶������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��îÅ�Zd��¤ôLn¶������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��îÅ�Z‚��ób`ý¶������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��îÅ�Zi��Þ”š%¶������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��îÅ�ZX��}`y¶������+���src/Composer/Package/Loader/ArrayLoader.php��îÅ�Z��n~œ›¶������7���src/Composer/Package/Loader/InvalidPackageException.phpE��îÅ�ZE��xb¾¶������*���src/Composer/Package/Loader/JsonLoader.phpù��îÅ�Zù��!~ˆ{¶������/���src/Composer/Package/Loader/LoaderInterface.php²���îÅ�Z²���¦}úζ������1���src/Composer/Package/Loader/RootPackageLoader.php$��îÅ�Z$��Ârü°¶������5���src/Composer/Package/Loader/ValidatingArrayLoader.phpÃ6��îÅ�ZÃ6��*ñS¶���������src/Composer/Package/Locker.php©!��îÅ�Z©!��AŠõë¶������ ���src/Composer/Package/Package.phpÉ��îÅ�ZÉ��cÃ�h¶������)���src/Composer/Package/PackageInterface.php ��îÅ�Z ��ûÇ^ƶ������)���src/Composer/Package/RootAliasPackage.php ��îÅ�Z �� _€ø¶������$���src/Composer/Package/RootPackage.php��îÅ�Z��ŽÎ_¶������-���src/Composer/Package/RootPackageInterface.php¹��îÅ�Z¹��"maV¶������/���src/Composer/Package/Version/VersionGuesser.phpO��îÅ�ZO��ˆSœ¶������.���src/Composer/Package/Version/VersionParser.phpo��îÅ�Zo��m€;¶������0���src/Composer/Package/Version/VersionSelector.phpK ��îÅ�ZK ��²<ȶ������-���src/Composer/Plugin/Capability/Capability.phpW���îÅ�ZW���æ_¨1¶������2���src/Composer/Plugin/Capability/CommandProvider.php—���îÅ�Z—���ûOâ>¶���������src/Composer/Plugin/Capable.php���îÅ�Z���Æq+¶������$���src/Composer/Plugin/CommandEvent.phpâ��îÅ�Zâ��³ÆÇW¶������$���src/Composer/Plugin/PluginEvents.phpö���îÅ�Zö���á1=z¶������'���src/Composer/Plugin/PluginInterface.phpô���îÅ�Zô���)'*ض������%���src/Composer/Plugin/PluginManager.php$��îÅ�Z$��ëŽ"»¶������*���src/Composer/Plugin/PreCommandRunEvent.phpõ��îÅ�Zõ��:ðd¶������,���src/Composer/Plugin/PreFileDownloadEvent.php`��îÅ�Z`���9-ζ������4���src/Composer/Question/StrictConfirmationQuestion.php��îÅ�Z��'.³è¶������+���src/Composer/Repository/ArrayRepository.php��îÅ�Z��éÌt�¶������.���src/Composer/Repository/ArtifactRepository.php» ��îÅ�Z» ��ˆÝ÷<¶������*���src/Composer/Repository/BaseRepository.php] ��îÅ�Z] ��ä&3‡¶������.���src/Composer/Repository/ComposerRepository.php‡T��îÅ�Z‡T��Ç“×{¶������/���src/Composer/Repository/CompositeRepository.php;��îÅ�Z;��¤¯S¶������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���îÅ�Z…���±Ÿ_¶������0���src/Composer/Repository/FilesystemRepository.php$��îÅ�Z$��¾Ãá…¶������4���src/Composer/Repository/InstalledArrayRepository.php£���îÅ�Z£���/ö~>¶������9���src/Composer/Repository/InstalledFilesystemRepository.php£���îÅ�Z£���V
  37. •_¶������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���îÅ�Z‡���£9p¶������6���src/Composer/Repository/InvalidRepositoryException.phpn���îÅ�Zn���à“똶������-���src/Composer/Repository/PackageRepository.phpj��îÅ�Zj��¥ôò̶������*���src/Composer/Repository/PathRepository.phpw
  38. ��îÅ�Zw
  39. ���~õ³¶������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��îÅ�ZI��c6³¶������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��îÅ�ZÄ��:T*ɶ������.���src/Composer/Repository/Pear/ChannelReader.phpí��îÅ�Zí��?ÈYT¶������4���src/Composer/Repository/Pear/ChannelRest10Reader.php® ��îÅ�Z® ��™ÖÛú¶������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��îÅ�Z& ��òUb¶������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��îÅ�Zq��9=¶������/���src/Composer/Repository/Pear/DependencyInfo.phpq��îÅ�Zq��fºTò¶������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��îÅ�Z…��÷$Li¶������,���src/Composer/Repository/Pear/PackageInfo.php°��îÅ�Z°��Ÿ ¸ ¶������,���src/Composer/Repository/Pear/ReleaseInfo.php’��îÅ�Z’��o“ŠÃ¶������*���src/Composer/Repository/PearRepository.phpª��îÅ�Zª��)Ÿƒ}¶������.���src/Composer/Repository/PlatformRepository.php��îÅ�Z��fVÉ¢¶������-���src/Composer/Repository/RepositoryFactory.php2��îÅ�Z2��t>¶������/���src/Composer/Repository/RepositoryInterface.phpÛ��îÅ�ZÛ��’âÁ¶������-���src/Composer/Repository/RepositoryManager.php,
  40. ��îÅ�Z,
  41. ��¾…\•¶������7���src/Composer/Repository/RepositorySecurityException.phpo���îÅ�Zo���pÕ«ª¶������/���src/Composer/Repository/Vcs/BitbucketDriver.phpô��îÅ�Zô��x¤ü¶������,���src/Composer/Repository/Vcs/FossilDriver.php���îÅ�Z���À]µ¶������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpê��îÅ�Zê��ÃŽ»¶������)���src/Composer/Repository/Vcs/GitDriver.php¼��îÅ�Z¼��Š©Ðê¶������,���src/Composer/Repository/Vcs/GitHubDriver.php¡+��îÅ�Z¡+��ýYû
  42. ¶������,���src/Composer/Repository/Vcs/GitLabDriver.phpÍ#��îÅ�ZÍ#��ßNìʶ������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpä��îÅ�Zä��i›üà¶������(���src/Composer/Repository/Vcs/HgDriver.phpe��îÅ�Ze��O!O¶������.���src/Composer/Repository/Vcs/PerforceDriver.php' ��îÅ�Z' ��ÙóH¶������)���src/Composer/Repository/Vcs/SvnDriver.php��îÅ�Z��Õzï¶������)���src/Composer/Repository/Vcs/VcsDriver.phpæ
  43. ��îÅ�Zæ
  44. ��eׯ-¶������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��îÅ�Z÷��ÇX[‰¶������)���src/Composer/Repository/VcsRepository.php !��îÅ�Z !��cÕK¶������3���src/Composer/Repository/WritableArrayRepository.php��îÅ�Z��¾G*¶������7���src/Composer/Repository/WritableRepositoryInterface.php‰��îÅ�Z‰��‘/sï¶������$���src/Composer/Script/CommandEvent.phpW���îÅ�ZW���£VZt¶���������src/Composer/Script/Event.phpµ��îÅ�Zµ��lt¦M¶������$���src/Composer/Script/PackageEvent.phpœ���îÅ�Zœ���§ÿÉ ¶������$���src/Composer/Script/ScriptEvents.phpP��îÅ�ZP��‡�¶¶������ ���src/Composer/SelfUpdate/Keys.php���îÅ�Z��� îÊN¶������$���src/Composer/SelfUpdate/Versions.phpì��îÅ�Zì��͵‘ƒ¶������ ���src/Composer/Util/AuthHelper.phpË��îÅ�ZË��>zx–¶���������src/Composer/Util/Bitbucket.php%��îÅ�Z%��n=gÓ¶������$���src/Composer/Util/ComposerMirror.php±��îÅ�Z±��­½øØ¶������%���src/Composer/Util/ConfigValidator.php÷��îÅ�Z÷��v•Ͷ������"���src/Composer/Util/ErrorHandler.php‡��îÅ�Z‡��He"¶������ ���src/Composer/Util/Filesystem.php3/��îÅ�Z3/��m44ô¶���������src/Composer/Util/Git.php!&��îÅ�Z!&��lsý×¶���������src/Composer/Util/GitHub.phpÏ
  45. ��îÅ�ZÏ
  46. ��ÁØ\å¶���������src/Composer/Util/GitLab.php™ ��îÅ�Z™ ��BLF¶���������src/Composer/Util/IniHelper.php]��îÅ�Z]��®äéä¶������$���src/Composer/Util/NoProxyPattern.php¾��îÅ�Z¾��Z+°m¶���������src/Composer/Util/Perforce.php‚1��îÅ�Z‚1��,œbx¶���������src/Composer/Util/Platform.phpü��îÅ�Zü��s­fç¶������%���src/Composer/Util/ProcessExecutor.phpÚ ��îÅ�ZÚ ��£ÒÙ¶������&���src/Composer/Util/RemoteFilesystem.phpäc��îÅ�Zäc��n#4¶���������src/Composer/Util/Silencer.phpé��îÅ�Zé��“Vjf¶������!���src/Composer/Util/SpdxLicense.php��îÅ�Z��¾7
  47. ñ¶������*���src/Composer/Util/StreamContextFactory.php��îÅ�Z��ú(¢^¶���������src/Composer/Util/Svn.php‚��îÅ�Z‚�� Vr¶���������src/Composer/Util/TlsHelper.phpp
  48. ��îÅ�Zp
  49. ��¤eÞæ¶���������src/Composer/Util/Url.phpÀ��îÅ�ZÀ��lqh¶���������src/Composer/XdebugHandler.php“��îÅ�Z“��ÕWÖ>¶���������src/bootstrap.php¹��îÅ�Z¹��I}œ¶������%���src/Composer/Autoload/ClassLoader.phpl4��îÅ�Zl4��’ø[÷¶������#���res/composer-repository-schema.jsonð��îÅ�Zð���GÐà¶���������res/composer-schema.jsony•��îÅ�Zy•��³Ì¶`¶������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json}��îÅ�Z}��/Yž¶������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonàŒ��îÅ�ZàŒ��£O¶������*���vendor/seld/cli-prompt/res/hiddeninput.exe�$��îÅ�Z�$��•�¥v¶������&���vendor/symfony/console/Application.php#W��îÅ�Z#W��èðz¶������*���vendor/symfony/console/Command/Command.phpò"��îÅ�Zò"��ÊRÑç¶������.���vendor/symfony/console/Command/HelpCommand.phpØ��îÅ�ZØ��$Y«¶������.���vendor/symfony/console/Command/ListCommand.phpZ��îÅ�ZZ��É£ ¶������(���vendor/symfony/console/ConsoleEvents.phpé���îÅ�Zé���RÛÔe¶������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÐ��îÅ�ZÐ��™Ž5°¶������0���vendor/symfony/console/Descriptor/Descriptor.phpŽ��îÅ�ZŽ��éð8Ÿ¶������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���îÅ�Zü���±Qµ¶������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpá ��îÅ�Zá ��‡ àÆ¶������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¹��îÅ�Z¹��kŸ.a¶������4���vendor/symfony/console/Descriptor/TextDescriptor.php²��îÅ�Z²���­ùâ¶������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��îÅ�Z��
  50. ]…ζ������4���vendor/symfony/console/Event/ConsoleCommandEvent.php°��îÅ�Z°��!�ȶ������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��îÅ�ZÅ��ÒxÛ\¶������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��îÅ�Z��á2é¶������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��îÅ�Zz��³,îL¶������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��îÅ�ZÔ��È÷ L¶������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���îÅ�Zf���¡ABª¶������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���îÅ�Z¦���Ö̽Z¶������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���îÅ�Z¦���Ë×H¶������3���vendor/symfony/console/Exception/LogicException.php’���îÅ�Z’���ÍO\e¶������5���vendor/symfony/console/Exception/RuntimeException.php–���îÅ�Z–���Ùí,6¶������4���vendor/symfony/console/Formatter/OutputFormatter.php2��îÅ�Z2��RÌYh¶������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒ��îÅ�ZŒ��òññÀ¶������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpJ��îÅ�ZJ��ÏDSȶ������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„��îÅ�Z„��÷½G¶������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php>��îÅ�Z>��[†¿–¶������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpx��îÅ�Zx��N©Ø¼¶������2���vendor/symfony/console/Helper/DescriptorHelper.phpw��îÅ�Zw��ÅHð.¶������.���vendor/symfony/console/Helper/DialogHelper.phpú��îÅ�Zú��¼ O�¶������1���vendor/symfony/console/Helper/FormatterHelper.phpc��îÅ�Zc��“ý«N¶������(���vendor/symfony/console/Helper/Helper.php¨��îÅ�Z¨��œoû3¶������1���vendor/symfony/console/Helper/HelperInterface.phpå���îÅ�Zå���Š ¶������+���vendor/symfony/console/Helper/HelperSet.phpÉ��îÅ�ZÉ��œf5¶������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��îÅ�Zc��ñø�|¶������/���vendor/symfony/console/Helper/ProcessHelper.phpÑ ��îÅ�ZÑ ��@±ã�¶������-���vendor/symfony/console/Helper/ProgressBar.phpk%��îÅ�Zk%��ìîa¶������0���vendor/symfony/console/Helper/ProgressHelper.php\��îÅ�Z\��‘ÃYÓ¶������3���vendor/symfony/console/Helper/ProgressIndicator.phpK��îÅ�ZK��íͰ¶������0���vendor/symfony/console/Helper/QuestionHelper.php ��îÅ�Z ��Lú4¶������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.phpl
  51. ��îÅ�Zl
  52. ��÷ÞL¶������'���vendor/symfony/console/Helper/Table.php¨*��îÅ�Z¨*��e{))¶������+���vendor/symfony/console/Helper/TableCell.php€��îÅ�Z€��Ìî*Û¶������-���vendor/symfony/console/Helper/TableHelper.php ��îÅ�Z ��QRº¶������0���vendor/symfony/console/Helper/TableSeparator.phpÊ���îÅ�ZÊ���az¶������,���vendor/symfony/console/Helper/TableStyle.php
  53. ��îÅ�Z
  54. ��PÞµ¦¶������*���vendor/symfony/console/Input/ArgvInput.php7��îÅ�Z7��ØQ|ʶ������+���vendor/symfony/console/Input/ArrayInput.php ��îÅ�Z ��ʹóþ¶������&���vendor/symfony/console/Input/Input.php¢ ��îÅ�Z¢ ��”‡B"¶������.���vendor/symfony/console/Input/InputArgument.php��îÅ�Z��&<¦¯¶������4���vendor/symfony/console/Input/InputAwareInterface.phpš���îÅ�Zš���‡jTŸ¶������0���vendor/symfony/console/Input/InputDefinition.phpŠ��îÅ�ZŠ��émáP¶������/���vendor/symfony/console/Input/InputInterface.php���îÅ�Z���®#£¶������,���vendor/symfony/console/Input/InputOption.php ��îÅ�Z ��ùýN4¶������,���vendor/symfony/console/Input/StringInput.php–��îÅ�Z–��cì\(¶���������vendor/symfony/console/LICENSE)��îÅ�Z)��·)E`¶������/���vendor/symfony/console/Logger/ConsoleLogger.php. ��îÅ�Z. ��¤Œ…ζ������0���vendor/symfony/console/Output/BufferedOutput.php_��îÅ�Z_��‹ >P¶������/���vendor/symfony/console/Output/ConsoleOutput.php°��îÅ�Z°��]k~o¶������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpà���îÅ�Zà���‡†ÆÊ¶������,���vendor/symfony/console/Output/NullOutput.phpÏ��îÅ�ZÏ��®˜‹Z¶������(���vendor/symfony/console/Output/Output.php˜ ��îÅ�Z˜ ��pf\¶������1���vendor/symfony/console/Output/OutputInterface.php��îÅ�Z���ì&¶������.���vendor/symfony/console/Output/StreamOutput.phpÂ��îÅ�ZÂ��¥<I¶������2���vendor/symfony/console/Question/ChoiceQuestion.phpw
  55. ��îÅ�Zw
  56. ��2t¶������8���vendor/symfony/console/Question/ConfirmationQuestion.phpç��îÅ�Zç�� ­òf¶������,���vendor/symfony/console/Question/Question.phpË ��îÅ�ZË ��ÒqµR¶������ ���vendor/symfony/console/Shell.phpå��îÅ�Zå��•šxS¶������,���vendor/symfony/console/Style/OutputStyle.php\��îÅ�Z\��wפ¶������/���vendor/symfony/console/Style/StyleInterface.phpÏ��îÅ�ZÏ��&nÅѶ������-���vendor/symfony/console/Style/SymfonyStyle.php¶��îÅ�Z¶��ª×ì¶������3���vendor/symfony/console/Tester/ApplicationTester.phpÏ��îÅ�ZÏ��sž9i¶������/���vendor/symfony/console/Tester/CommandTester.phpª��îÅ�Zª��µ.âr¶������(���vendor/symfony/debug/BufferingLogger.phpt��îÅ�Zt��=�hܶ���������vendor/symfony/debug/Debug.phpé��îÅ�Zé��Àxa?¶������)���vendor/symfony/debug/DebugClassLoader.php¡��îÅ�Z¡��ó€v‡¶������%���vendor/symfony/debug/ErrorHandler.php€C��îÅ�Z€C��¥æõ¾¶������9���vendor/symfony/debug/Exception/ClassNotFoundException.php„��îÅ�Z„��n�¡…¶������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��îÅ�Z˜��-
  57. d2¶������1���vendor/symfony/debug/Exception/DummyException.php��îÅ�Z��-"ûd¶������6���vendor/symfony/debug/Exception/FatalErrorException.phpï��îÅ�Zï��æ fz¶������6���vendor/symfony/debug/Exception/FatalThrowableError.phpD��îÅ�ZD��¡ Âí¶������3���vendor/symfony/debug/Exception/FlattenException.php²��îÅ�Z²��HòѶ������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���îÅ�Z~���ë¨oâ¶������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpˆ��îÅ�Zˆ��¢G‚n¶������;���vendor/symfony/debug/Exception/UndefinedMethodException.php†��îÅ�Z†��¨LÚ:¶������)���vendor/symfony/debug/ExceptionHandler.php3��îÅ�Z3��ièŠ4¶������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php7��îÅ�Z7��Ñj/=¶������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��îÅ�Z��ĹBV¶������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpu��îÅ�Zu��éj¶������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpN��îÅ�ZN��Ço-ç¶���������vendor/symfony/debug/LICENSE)��îÅ�Z)��·)E`¶������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���îÅ�Zi���$ ÿ›¶������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��îÅ�Z¼��pí\¶¶������3���vendor/symfony/filesystem/Exception/IOException.php‡��îÅ�Z‡��€ü#Ѷ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���îÅ�Z¦���jÙwM¶������(���vendor/symfony/filesystem/Filesystem.phpö2��îÅ�Zö2��ëP�ò¶������!���vendor/symfony/filesystem/LICENSE)��îÅ�Z)��·)E`¶������)���vendor/symfony/filesystem/LockHandler.php¢��îÅ�Z¢��D‘;i¶������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��îÅ�Z\ ��Ɠɀ¶������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php‹��îÅ�Z‹��]vk1¶������2���vendor/symfony/finder/Adapter/AdapterInterface.php›��îÅ�Z›��Mþ¶������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php2��îÅ�Z2��Q/ÇC¶������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��îÅ�Z��( í?¶������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��îÅ�Zô��:?¶������/���vendor/symfony/finder/Comparator/Comparator.phpŒ��îÅ�ZŒ��wþT¶������3���vendor/symfony/finder/Comparator/DateComparator.php#��îÅ�Z#��°ζ������5���vendor/symfony/finder/Comparator/NumberComparator.php|��îÅ�Z|��ITÇͶ������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���îÅ�Z„���½¾sœ¶������;���vendor/symfony/finder/Exception/AdapterFailureException.php¬��îÅ�Z¬��X呞¶������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���îÅ�Z„���Gz-¶������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��îÅ�Z)��ìcj=¶������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpº��îÅ�Zº��Êø¶������/���vendor/symfony/finder/Expression/Expression.php��îÅ�Z��µoÔ¶������)���vendor/symfony/finder/Expression/Glob.phpf��îÅ�Zf��lïÜP¶������*���vendor/symfony/finder/Expression/Regex.php��îÅ�Z��Qr“¡¶������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��îÅ�ZÍ��²~øb¶������ ���vendor/symfony/finder/Finder.php¹-��îÅ�Z¹-��Qÿ2¶���������vendor/symfony/finder/Glob.phpK��îÅ�ZK��já±n¶������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php[��îÅ�Z[��­åW¶������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpx��îÅ�Zx��ôP¶������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpî��îÅ�Zî��üÍ�q¶������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpí��îÅ�Zí��nõH¶������4���vendor/symfony/finder/Iterator/FilePathsIterator.php ��îÅ�Z ��fQCe¶������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZ��îÅ�ZZ��(&ø¶������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��îÅ�Z5��ší¶������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��îÅ�Zr��tu¶������1���vendor/symfony/finder/Iterator/FilterIterator.phpÃ��îÅ�ZÃ��š+µÞ¶������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-��îÅ�Z-��ºÎÒ_¶������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÏ��îÅ�ZÏ��ºªÇ¶������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��îÅ�Z �� ÿ¶������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpe��îÅ�Ze��Ÿ’áé¶������3���vendor/symfony/finder/Iterator/SortableIterator.php*��îÅ�Z*��€õ´^¶���������vendor/symfony/finder/LICENSE)��îÅ�Z)��·)E`¶������'���vendor/symfony/finder/Shell/Command.php? ��îÅ�Z? ��šPw‰¶������%���vendor/symfony/finder/Shell/Shell.phpp��îÅ�Zp��Ó}g¶������%���vendor/symfony/finder/SplFileInfo.phpý��îÅ�Zý��`ØÓ¶������(���vendor/symfony/polyfill-mbstring/LICENSE)��îÅ�Z)��î*L¶������-���vendor/symfony/polyfill-mbstring/Mbstring.phpÄ6��îÅ�ZÄ6��U.ݶ������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php2A��îÅ�Z2A��½=¨¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php¡A��îÅ�Z¡A��Ú Í¶������.���vendor/symfony/polyfill-mbstring/bootstrap.php±��îÅ�Z±��|Š©Ò¶������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���îÅ�Zf���]ö>T¶������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���îÅ�Z¨���ÐÀ+_¶������3���vendor/symfony/process/Exception/LogicException.php”���îÅ�Z”��� ³ãñ¶������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��îÅ�Zx��¨Ìzy¶������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��îÅ�Z��ï«¶������5���vendor/symfony/process/Exception/RuntimeException.php˜���îÅ�Z˜���¢Ø:¶������+���vendor/symfony/process/ExecutableFinder.php™��îÅ�Z™��|O¿é¶���������vendor/symfony/process/LICENSE)��îÅ�Z)��·)E`¶������.���vendor/symfony/process/PhpExecutableFinder.phpg��îÅ�Zg���çµ¶������%���vendor/symfony/process/PhpProcess.phpú��îÅ�Zú��¯“Õ�¶������.���vendor/symfony/process/Pipes/AbstractPipes.php]��îÅ�Z]��g`¶������/���vendor/symfony/process/Pipes/PipesInterface.phpD��îÅ�ZD��vØî¡¶������*���vendor/symfony/process/Pipes/UnixPipes.phpâ��îÅ�Zâ��ßŶ������-���vendor/symfony/process/Pipes/WindowsPipes.php‰ ��îÅ�Z‰ ��À"¢¶������"���vendor/symfony/process/Process.php£R��îÅ�Z£R��‹„&E¶������)���vendor/symfony/process/ProcessBuilder.phpß
  58. ��îÅ�Zß
  59. ��^ƒ8¶������'���vendor/symfony/process/ProcessUtils.phpK��îÅ�ZK��µ½~ò¶���������vendor/seld/jsonlint/LICENSE"��îÅ�Z"��aƒsy¶������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��îÅ�Z*��•pñ¶������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php/2��îÅ�Z/2��­ß˜ö¶������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php��îÅ�Z��%ÿ3N¶������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��îÅ�Z��‰²ñ¶������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���îÅ�Z>���ÿqŸŸ¶���������vendor/seld/cli-prompt/LICENSE"��îÅ�Z"��ˆñ?e¶������&���vendor/seld/cli-prompt/res/example.php'��îÅ�Z'��I£¶������(���vendor/seld/cli-prompt/src/CliPrompt.phpC��îÅ�ZC��Ð}�p¶������(���vendor/justinrainbow/json-schema/LICENSE ��îÅ�Z ��ºç©¶������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��îÅ�Zñ��fC¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��îÅ�Z¡ ��†wÌl¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php) ��îÅ�Z) ��#©¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php ��îÅ�Z ��Òé`¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��îÅ�Z¼��ÿ Qœ¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��îÅ�Z]��VŽU<¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php; ��îÅ�Z; ��!/)¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…��îÅ�Z…��“TœÚ¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpš
  60. ��îÅ�Zš
  61. ��z&¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃ��îÅ�ZÃ��©Å¼x¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.phpN ��îÅ�ZN ��QÓmV¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php��îÅ�Z��¥wš‡¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��îÅ�Za�� qö������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.phpp��îÅ�Zp��rë¶������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��îÅ�Z‰��“µ+j¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��îÅ�Z&��4˜©T¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpr!��îÅ�Zr!��‰Ö‘¶������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��îÅ�Zè��{N–¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���îÅ�ZI���%|°¶������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���îÅ�Z•���‹àG¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���îÅ�Zl���A!L×¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���îÅ�Zl���è2÷þ¶������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���îÅ�Zu���=hç¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���îÅ�Zw���N-ò[¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��îÅ�ZÞ��\¸
  62. ¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���îÅ�Zo���píÛù¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���îÅ�Z…���%…—¶������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���îÅ�Z€���u-#1¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���îÅ�Zj���å>�¶������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���îÅ�Zf���¬¤„þ¶������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��îÅ�Zþ��M�„õ¶������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��îÅ�Z ��f4÷³¶������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ��îÅ�Zœ ��åfO¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��îÅ�Z��oŠ+}¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���îÅ�Zá���[þA�¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥��îÅ�Z¥��Ô§Lb¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%��îÅ�Z%��5" ¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��îÅ�Z,��1•5þ¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���îÅ�Z®���ÿ‹Áå¶������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��îÅ�Z ��£Ÿ)à¶������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php&��îÅ�Z&��¼î‚¢¶������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���îÅ�Zƒ���J€¶������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���îÅ�Z…���íæe¶������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpÇ��îÅ�ZÇ��ù…oÞ¶������%���vendor/composer/spdx-licenses/LICENSE��îÅ�Z��Bhí¶������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpH��îÅ�ZH��͉T¶���������vendor/composer/semver/LICENSE��îÅ�Z��Bhí¶������)���vendor/composer/semver/src/Comparator.php��îÅ�Z��wlƒï¶������<���vendor/composer/semver/src/Constraint/AbstractConstraint.php×��îÅ�Z×��õî>޶������4���vendor/composer/semver/src/Constraint/Constraint.phpª ��îÅ�Zª ��ÇO7²¶������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���îÅ�Zß���0C,‡¶������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpé��îÅ�Zé��!-Ø™¶������9���vendor/composer/semver/src/Constraint/MultiConstraint.php1��îÅ�Z1��í xU¶������%���vendor/composer/semver/src/Semver.phpv��îÅ�Zv��‹×È›¶������,���vendor/composer/semver/src/VersionParser.php¿*��îÅ�Z¿*��)mƶ������!���vendor/composer/ca-bundle/LICENSE��îÅ�Z��*!^`¶������*���vendor/composer/ca-bundle/src/CaBundle.php��îÅ�Z��Ê ~Ķ���������vendor/psr/log/LICENSE=��îÅ�Z=��p±ŽO¶������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��îÅ�Z;��ñ>3[¶������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���îÅ�Z`��� ˆX1¶������#���vendor/psr/log/Psr/Log/LogLevel.phpû���îÅ�Zû���jðñ8¶������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���îÅ�Z|���$£ˆ¶������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���îÅ�Z§���T½úB¶������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÆ��îÅ�ZÆ��»sg¶������&���vendor/psr/log/Psr/Log/LoggerTrait.phpi��îÅ�Zi��35§Þ¶������%���vendor/psr/log/Psr/Log/NullLogger.phpž���îÅ�Zž���Çö������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpü ��îÅ�Zü ��iq0ض���������vendor/autoload.php‚���îÅ�Z‚���¼ºzo¶������'���vendor/composer/autoload_namespaces.phpd���îÅ�Zd���Z¡¦H¶������!���vendor/composer/autoload_psr4.php˜��îÅ�Z˜��ž{¢¶������%���vendor/composer/autoload_classmap.phpd���îÅ�Zd���Z¡¦H¶������"���vendor/composer/autoload_files.phpÃ���îÅ�ZÃ���ÒÂür¶������!���vendor/composer/autoload_real.phpI��îÅ�ZI��$Þ²+¶������#���vendor/composer/autoload_static.php¬ ��îÅ�Z¬ ��|ˆÌ¶���������vendor/composer/ClassLoader.php���îÅ�Z���‚Aãd¶������(���vendor/composer/ca-bundle/res/cacert.pemš�îÅ�Zš�Û¾§¶������ ���bin/composer ��îÅ�Z ��О=¶���������LICENSE.��îÅ�Z.�� Õ¶������<?php
  63. namespace Composer\Autoload;
  64. use Composer\Config;
  65. use Composer\EventDispatcher\EventDispatcher;
  66. use Composer\Installer\InstallationManager;
  67. use Composer\IO\IOInterface;
  68. use Composer\Package\AliasPackage;
  69. use Composer\Package\PackageInterface;
  70. use Composer\Repository\InstalledRepositoryInterface;
  71. use Composer\Util\Filesystem;
  72. use Composer\Script\ScriptEvents;
  73. class AutoloadGenerator
  74. {
  75. private $eventDispatcher;
  76. private $io;
  77. private $devMode = false;
  78. private $classMapAuthoritative = false;
  79. private $apcu = false;
  80. private $runScripts = false;
  81. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  82. {
  83. $this->eventDispatcher = $eventDispatcher;
  84. $this->io = $io;
  85. }
  86. public function setDevMode($devMode = true)
  87. {
  88. $this->devMode = (bool) $devMode;
  89. }
  90. public function setClassMapAuthoritative($classMapAuthoritative)
  91. {
  92. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  93. }
  94. public function setApcu($apcu)
  95. {
  96. $this->apcu = (bool) $apcu;
  97. }
  98. public function setRunScripts($runScripts = true)
  99. {
  100. $this->runScripts = (bool) $runScripts;
  101. }
  102. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  103. {
  104. if ($this->classMapAuthoritative) {
  105. $scanPsr0Packages = true;
  106. }
  107. if ($this->runScripts) {
  108. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  109. 'optimize' => (bool) $scanPsr0Packages,
  110. ));
  111. }
  112. $filesystem = new Filesystem();
  113. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  114. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  115. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  116. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  117. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  118. $targetDir = $vendorPath.'/'.$targetDir;
  119. $filesystem->ensureDirectoryExists($targetDir);
  120. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  121. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  122. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  123. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  124. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  125. $namespacesFile = <<<EOF
  126. <?php
  127. // autoload_namespaces.php @generated by Composer
  128. \$vendorDir = $vendorPathCode52;
  129. \$baseDir = $appBaseDirCode;
  130. return array(
  131. EOF;
  132. $psr4File = <<<EOF
  133. <?php
  134. // autoload_psr4.php @generated by Composer
  135. \$vendorDir = $vendorPathCode52;
  136. \$baseDir = $appBaseDirCode;
  137. return array(
  138. EOF;
  139. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  140. $autoloads = $this->parseAutoloads($packageMap, $mainPackage);
  141. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  142. $exportedPaths = array();
  143. foreach ($paths as $path) {
  144. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  145. }
  146. $exportedPrefix = var_export($namespace, true);
  147. $namespacesFile .= " $exportedPrefix => ";
  148. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  149. }
  150. $namespacesFile .= ");\n";
  151. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  152. $exportedPaths = array();
  153. foreach ($paths as $path) {
  154. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  155. }
  156. $exportedPrefix = var_export($namespace, true);
  157. $psr4File .= " $exportedPrefix => ";
  158. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  159. }
  160. $psr4File .= ");\n";
  161. $classmapFile = <<<EOF
  162. <?php
  163. // autoload_classmap.php @generated by Composer
  164. \$vendorDir = $vendorPathCode52;
  165. \$baseDir = $appBaseDirCode;
  166. return array(
  167. EOF;
  168. $targetDirLoader = null;
  169. $mainAutoload = $mainPackage->getAutoload();
  170. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  171. $levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
  172. $prefixes = implode(', ', array_map(function ($prefix) {
  173. return var_export($prefix, true);
  174. }, array_keys($mainAutoload['psr-0'])));
  175. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  176. $targetDirLoader = <<<EOF
  177. public static function autoload(\$class)
  178. {
  179. \$dir = $baseDirFromTargetDirCode . '/';
  180. \$prefixes = array($prefixes);
  181. foreach (\$prefixes as \$prefix) {
  182. if (0 !== strpos(\$class, \$prefix)) {
  183. continue;
  184. }
  185. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  186. if (!\$path = stream_resolve_include_path(\$path)) {
  187. return false;
  188. }
  189. require \$path;
  190. return true;
  191. }
  192. }
  193. EOF;
  194. }
  195. $blacklist = null;
  196. if (!empty($autoloads['exclude-from-classmap'])) {
  197. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  198. }
  199. $classMap = array();
  200. if ($scanPsr0Packages) {
  201. $namespacesToScan = array();
  202. foreach (array('psr-0', 'psr-4') as $psrType) {
  203. foreach ($autoloads[$psrType] as $namespace => $paths) {
  204. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  205. }
  206. }
  207. krsort($namespacesToScan);
  208. foreach ($namespacesToScan as $namespace => $groups) {
  209. foreach ($groups as $group) {
  210. foreach ($group['paths'] as $dir) {
  211. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  212. if (!is_dir($dir)) {
  213. continue;
  214. }
  215. $namespaceFilter = $namespace === '' ? null : $namespace;
  216. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  217. }
  218. }
  219. }
  220. }
  221. foreach ($autoloads['classmap'] as $dir) {
  222. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  223. }
  224. ksort($classMap);
  225. foreach ($classMap as $class => $code) {
  226. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  227. }
  228. $classmapFile .= ");\n";
  229. if (!$suffix) {
  230. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  231. $content = file_get_contents($vendorPath.'/autoload.php');
  232. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  233. $suffix = $match[1];
  234. }
  235. }
  236. if (!$suffix) {
  237. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  238. }
  239. }
  240. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  241. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  242. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  243. $includePathFilePath = $targetDir.'/include_paths.php';
  244. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  245. file_put_contents($includePathFilePath, $includePathFileContents);
  246. } elseif (file_exists($includePathFilePath)) {
  247. unlink($includePathFilePath);
  248. }
  249. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  250. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  251. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  252. } elseif (file_exists($includeFilesFilePath)) {
  253. unlink($includeFilesFilePath);
  254. }
  255. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  256. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  257. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  258. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  259. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  260. if ($this->runScripts) {
  261. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  262. 'optimize' => (bool) $scanPsr0Packages,
  263. ));
  264. }
  265. }
  266. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
  267. {
  268. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
  269. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  270. if (!isset($classMap[$class])) {
  271. $classMap[$class] = $pathCode;
  272. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  273. $this->io->writeError(
  274. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  275. ' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
  276. );
  277. }
  278. }
  279. return $classMap;
  280. }
  281. private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
  282. {
  283. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
  284. }
  285. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  286. {
  287. $packageMap = array(array($mainPackage, ''));
  288. foreach ($packages as $package) {
  289. if ($package instanceof AliasPackage) {
  290. continue;
  291. }
  292. $this->validatePackage($package);
  293. $packageMap[] = array(
  294. $package,
  295. $installationManager->getInstallPath($package),
  296. );
  297. }
  298. return $packageMap;
  299. }
  300. protected function validatePackage(PackageInterface $package)
  301. {
  302. $autoload = $package->getAutoload();
  303. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  304. $name = $package->getName();
  305. $package->getTargetDir();
  306. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  307. }
  308. if (!empty($autoload['psr-4'])) {
  309. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  310. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  311. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  312. }
  313. }
  314. }
  315. }
  316. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage)
  317. {
  318. $mainPackageMap = array_shift($packageMap);
  319. $sortedPackageMap = $this->sortPackageMap($packageMap);
  320. $sortedPackageMap[] = $mainPackageMap;
  321. array_unshift($packageMap, $mainPackageMap);
  322. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  323. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  324. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  325. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  326. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  327. krsort($psr0);
  328. krsort($psr4);
  329. return array(
  330. 'psr-0' => $psr0,
  331. 'psr-4' => $psr4,
  332. 'classmap' => $classmap,
  333. 'files' => $files,
  334. 'exclude-from-classmap' => $exclude,
  335. );
  336. }
  337. public function createLoader(array $autoloads)
  338. {
  339. $loader = new ClassLoader();
  340. if (isset($autoloads['psr-0'])) {
  341. foreach ($autoloads['psr-0'] as $namespace => $path) {
  342. $loader->add($namespace, $path);
  343. }
  344. }
  345. if (isset($autoloads['psr-4'])) {
  346. foreach ($autoloads['psr-4'] as $namespace => $path) {
  347. $loader->addPsr4($namespace, $path);
  348. }
  349. }
  350. if (isset($autoloads['classmap'])) {
  351. $blacklist = null;
  352. if (!empty($autoloads['exclude-from-classmap'])) {
  353. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  354. }
  355. foreach ($autoloads['classmap'] as $dir) {
  356. try {
  357. $loader->addClassMap($this->generateClassMap($dir, $blacklist, null, false));
  358. } catch (\RuntimeException $e) {
  359. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  360. }
  361. }
  362. }
  363. return $loader;
  364. }
  365. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  366. {
  367. $includePaths = array();
  368. foreach ($packageMap as $item) {
  369. list($package, $installPath) = $item;
  370. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  371. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  372. }
  373. foreach ($package->getIncludePaths() as $includePath) {
  374. $includePath = trim($includePath, '/');
  375. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  376. }
  377. }
  378. if (!$includePaths) {
  379. return;
  380. }
  381. $includePathsCode = '';
  382. foreach ($includePaths as $path) {
  383. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  384. }
  385. return <<<EOF
  386. <?php
  387. // include_paths.php @generated by Composer
  388. \$vendorDir = $vendorPathCode;
  389. \$baseDir = $appBaseDirCode;
  390. return array(
  391. $includePathsCode);
  392. EOF;
  393. }
  394. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  395. {
  396. $filesCode = '';
  397. foreach ($files as $fileIdentifier => $functionFile) {
  398. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  399. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  400. }
  401. if (!$filesCode) {
  402. return false;
  403. }
  404. return <<<EOF
  405. <?php
  406. // autoload_files.php @generated by Composer
  407. \$vendorDir = $vendorPathCode;
  408. \$baseDir = $appBaseDirCode;
  409. return array(
  410. $filesCode);
  411. EOF;
  412. }
  413. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  414. {
  415. if (!$filesystem->isAbsolutePath($path)) {
  416. $path = $basePath . '/' . $path;
  417. }
  418. $path = $filesystem->normalizePath($path);
  419. $baseDir = '';
  420. if (strpos($path.'/', $vendorPath.'/') === 0) {
  421. $path = substr($path, strlen($vendorPath));
  422. $baseDir = '$vendorDir';
  423. if ($path !== false) {
  424. $baseDir .= " . ";
  425. }
  426. } else {
  427. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  428. if (!$filesystem->isAbsolutePath($path)) {
  429. $baseDir = '$baseDir . ';
  430. $path = '/' . $path;
  431. }
  432. }
  433. if (preg_match('/\.phar.+$/', $path)) {
  434. $baseDir = "'phar://' . " . $baseDir;
  435. }
  436. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  437. }
  438. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  439. {
  440. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  441. if ("'" === $lastChar || '"' === $lastChar) {
  442. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  443. } else {
  444. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  445. }
  446. return <<<AUTOLOAD
  447. <?php
  448. // autoload.php @generated by Composer
  449. require_once $vendorPathToTargetDirCode;
  450. return ComposerAutoloaderInit$suffix::getLoader();
  451. AUTOLOAD;
  452. }
  453. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  454. {
  455. $file = <<<HEADER
  456. <?php
  457. // autoload_real.php @generated by Composer
  458. class ComposerAutoloaderInit$suffix
  459. {
  460. private static \$loader;
  461. public static function loadClassLoader(\$class)
  462. {
  463. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  464. require __DIR__ . '/ClassLoader.php';
  465. }
  466. }
  467. public static function getLoader()
  468. {
  469. if (null !== self::\$loader) {
  470. return self::\$loader;
  471. }
  472. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  473. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  474. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  475. HEADER;
  476. if ($useIncludePath) {
  477. $file .= <<<'INCLUDE_PATH'
  478. $includePaths = require __DIR__ . '/include_paths.php';
  479. $includePaths[] = get_include_path();
  480. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  481. INCLUDE_PATH;
  482. }
  483. $file .= <<<STATIC_INIT
  484. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  485. if (\$useStaticLoader) {
  486. require_once __DIR__ . '/autoload_static.php';
  487. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  488. } else {
  489. STATIC_INIT;
  490. if (!$this->classMapAuthoritative) {
  491. $file .= <<<'PSR04'
  492. $map = require __DIR__ . '/autoload_namespaces.php';
  493. foreach ($map as $namespace => $path) {
  494. $loader->set($namespace, $path);
  495. }
  496. $map = require __DIR__ . '/autoload_psr4.php';
  497. foreach ($map as $namespace => $path) {
  498. $loader->setPsr4($namespace, $path);
  499. }
  500. PSR04;
  501. }
  502. if ($useClassMap) {
  503. $file .= <<<'CLASSMAP'
  504. $classMap = require __DIR__ . '/autoload_classmap.php';
  505. if ($classMap) {
  506. $loader->addClassMap($classMap);
  507. }
  508. CLASSMAP;
  509. }
  510. $file .= " }\n\n";
  511. if ($this->classMapAuthoritative) {
  512. $file .= <<<'CLASSMAPAUTHORITATIVE'
  513. $loader->setClassMapAuthoritative(true);
  514. CLASSMAPAUTHORITATIVE;
  515. }
  516. if ($this->apcu) {
  517. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  518. $file .= <<<APCU
  519. \$loader->setApcuPrefix('$apcuPrefix');
  520. APCU;
  521. }
  522. if ($useGlobalIncludePath) {
  523. $file .= <<<'INCLUDEPATH'
  524. $loader->setUseIncludePath(true);
  525. INCLUDEPATH;
  526. }
  527. if ($targetDirLoader) {
  528. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  529. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  530. REGISTER_TARGET_DIR_AUTOLOAD;
  531. }
  532. $file .= <<<REGISTER_LOADER
  533. \$loader->register($prependAutoloader);
  534. REGISTER_LOADER;
  535. if ($useIncludeFiles) {
  536. $file .= <<<INCLUDE_FILES
  537. if (\$useStaticLoader) {
  538. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  539. } else {
  540. \$includeFiles = require __DIR__ . '/autoload_files.php';
  541. }
  542. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  543. composerRequire$suffix(\$fileIdentifier, \$file);
  544. }
  545. INCLUDE_FILES;
  546. }
  547. $file .= <<<METHOD_FOOTER
  548. return \$loader;
  549. }
  550. METHOD_FOOTER;
  551. $file .= $targetDirLoader;
  552. if ($useIncludeFiles) {
  553. return $file . <<<FOOTER
  554. }
  555. function composerRequire$suffix(\$fileIdentifier, \$file)
  556. {
  557. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  558. require \$file;
  559. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  560. }
  561. }
  562. FOOTER;
  563. }
  564. return $file . <<<FOOTER
  565. }
  566. FOOTER;
  567. }
  568. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  569. {
  570. $staticPhpVersion = 50600;
  571. $file = <<<HEADER
  572. <?php
  573. // autoload_static.php @generated by Composer
  574. namespace Composer\Autoload;
  575. class ComposerStaticInit$suffix
  576. {
  577. HEADER;
  578. $loader = new ClassLoader();
  579. $map = require $targetDir . '/autoload_namespaces.php';
  580. foreach ($map as $namespace => $path) {
  581. $loader->set($namespace, $path);
  582. }
  583. $map = require $targetDir . '/autoload_psr4.php';
  584. foreach ($map as $namespace => $path) {
  585. $loader->setPsr4($namespace, $path);
  586. }
  587. $classMap = require $targetDir . '/autoload_classmap.php';
  588. if ($classMap) {
  589. $loader->addClassMap($classMap);
  590. }
  591. $filesystem = new Filesystem();
  592. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  593. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  594. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  595. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  596. $initializer = '';
  597. $prefix = "\0Composer\Autoload\ClassLoader\0";
  598. $prefixLen = strlen($prefix);
  599. if (file_exists($targetDir . '/autoload_files.php')) {
  600. $maps = array('files' => require $targetDir . '/autoload_files.php');
  601. } else {
  602. $maps = array();
  603. }
  604. foreach ((array) $loader as $prop => $value) {
  605. if ($value && 0 === strpos($prop, $prefix)) {
  606. $maps[substr($prop, $prefixLen)] = $value;
  607. }
  608. }
  609. foreach ($maps as $prop => $value) {
  610. if (count($value) > 32767) {
  611. $staticPhpVersion = 70000;
  612. }
  613. $value = var_export($value, true);
  614. $value = str_replace($absoluteVendorPathCode, $vendorPathCode, $value);
  615. $value = str_replace($absoluteAppBaseDirCode, $appBaseDirCode, $value);
  616. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  617. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  618. if ('files' !== $prop) {
  619. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  620. }
  621. }
  622. return $file . <<<INITIALIZER
  623. public static function getInitializer(ClassLoader \$loader)
  624. {
  625. return \Closure::bind(function () use (\$loader) {
  626. $initializer
  627. }, null, ClassLoader::class);
  628. }
  629. }
  630. INITIALIZER;
  631. }
  632. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  633. {
  634. $autoloads = array();
  635. foreach ($packageMap as $item) {
  636. list($package, $installPath) = $item;
  637. $autoload = $package->getAutoload();
  638. if ($this->devMode && $package === $mainPackage) {
  639. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  640. }
  641. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  642. continue;
  643. }
  644. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  645. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  646. }
  647. foreach ($autoload[$type] as $namespace => $paths) {
  648. foreach ((array) $paths as $path) {
  649. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  650. if ($package === $mainPackage) {
  651. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  652. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  653. } else {
  654. $path = $package->getTargetDir() . '/' . $path;
  655. }
  656. }
  657. if ($type === 'exclude-from-classmap') {
  658. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  659. $path = str_replace('\\*\\*', '.+?', $path);
  660. $path = str_replace('\\*', '[^/]+?', $path);
  661. $updir = null;
  662. $path = preg_replace_callback(
  663. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  664. function ($matches) use (&$updir) {
  665. if (isset($matches[1])) {
  666. $updir = str_replace('\\.', '.', $matches[1]);
  667. }
  668. return '';
  669. },
  670. $path
  671. );
  672. if (empty($installPath)) {
  673. $installPath = strtr(getcwd(), '\\', '/');
  674. }
  675. $resolvedPath = realpath($installPath . '/' . $updir);
  676. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  677. continue;
  678. }
  679. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  680. if ($type === 'files') {
  681. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  682. continue;
  683. } elseif ($type === 'classmap') {
  684. $autoloads[] = $relativePath;
  685. continue;
  686. }
  687. $autoloads[$namespace][] = $relativePath;
  688. }
  689. }
  690. }
  691. return $autoloads;
  692. }
  693. protected function getFileIdentifier(PackageInterface $package, $path)
  694. {
  695. return md5($package->getName() . ':' . $path);
  696. }
  697. protected function sortPackageMap(array $packageMap)
  698. {
  699. $packages = array();
  700. $paths = array();
  701. $usageList = array();
  702. foreach ($packageMap as $item) {
  703. list($package, $path) = $item;
  704. $name = $package->getName();
  705. $packages[$name] = $package;
  706. $paths[$name] = $path;
  707. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  708. $target = $link->getTarget();
  709. $usageList[$target][] = $name;
  710. }
  711. }
  712. $computing = array();
  713. $computed = array();
  714. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  715. if (isset($computed[$name])) {
  716. return $computed[$name];
  717. }
  718. if (isset($computing[$name])) {
  719. return 0;
  720. }
  721. $computing[$name] = true;
  722. $weight = 0;
  723. if (isset($usageList[$name])) {
  724. foreach ($usageList[$name] as $user) {
  725. $weight -= 1 - $computeImportance($user);
  726. }
  727. }
  728. unset($computing[$name]);
  729. $computed[$name] = $weight;
  730. return $weight;
  731. };
  732. $weightList = array();
  733. foreach ($packages as $name => $package) {
  734. $weight = $computeImportance($name);
  735. $weightList[$name] = $weight;
  736. }
  737. $stable_sort = function (&$array) {
  738. static $transform, $restore;
  739. $i = 0;
  740. if (!$transform) {
  741. $transform = function (&$v, $k) use (&$i) {
  742. $v = array($v, ++$i, $k, $v);
  743. };
  744. $restore = function (&$v, $k) {
  745. $v = $v[3];
  746. };
  747. }
  748. array_walk($array, $transform);
  749. asort($array);
  750. array_walk($array, $restore);
  751. };
  752. $stable_sort($weightList);
  753. $sortedPackageMap = array();
  754. foreach (array_keys($weightList) as $name) {
  755. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  756. }
  757. return $sortedPackageMap;
  758. }
  759. protected function safeCopy($source, $target)
  760. {
  761. $source = fopen($source, 'r');
  762. $target = fopen($target, 'w+');
  763. stream_copy_to_stream($source, $target);
  764. fclose($source);
  765. fclose($target);
  766. }
  767. }
  768. <?php
  769. namespace Composer\Autoload;
  770. use Symfony\Component\Finder\Finder;
  771. use Composer\IO\IOInterface;
  772. use Composer\Util\Filesystem;
  773. class ClassMapGenerator
  774. {
  775. public static function dump($dirs, $file)
  776. {
  777. $maps = array();
  778. foreach ($dirs as $dir) {
  779. $maps = array_merge($maps, static::createMap($dir));
  780. }
  781. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  782. }
  783. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  784. {
  785. if (is_string($path)) {
  786. if (is_file($path)) {
  787. $path = array(new \SplFileInfo($path));
  788. } elseif (is_dir($path)) {
  789. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  790. } else {
  791. throw new \RuntimeException(
  792. 'Could not scan for classes inside "'.$path.
  793. '" which does not appear to be a file nor a folder'
  794. );
  795. }
  796. }
  797. $map = array();
  798. $filesystem = new Filesystem();
  799. $cwd = realpath(getcwd());
  800. foreach ($path as $file) {
  801. $filePath = $file->getPathname();
  802. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  803. continue;
  804. }
  805. if (!$filesystem->isAbsolutePath($filePath)) {
  806. $filePath = $cwd . '/' . $filePath;
  807. $filePath = $filesystem->normalizePath($filePath);
  808. } else {
  809. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  810. }
  811. if ($blacklist && preg_match($blacklist, strtr(realpath($filePath), '\\', '/'))) {
  812. continue;
  813. }
  814. $classes = self::findClasses($filePath);
  815. foreach ($classes as $class) {
  816. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  817. continue;
  818. }
  819. if (!isset($map[$class])) {
  820. $map[$class] = $filePath;
  821. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  822. $io->writeError(
  823. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  824. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  825. );
  826. }
  827. }
  828. }
  829. return $map;
  830. }
  831. private static function findClasses($path)
  832. {
  833. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  834. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  835. $extraTypes .= '|enum';
  836. }
  837. $contents = @php_strip_whitespace($path);
  838. if (!$contents) {
  839. if (!file_exists($path)) {
  840. $message = 'File at "%s" does not exist, check your classmap definitions';
  841. } elseif (!is_readable($path)) {
  842. $message = 'File at "%s" is not readable, check its permissions';
  843. } elseif ('' === trim(file_get_contents($path))) {
  844. return array();
  845. } else {
  846. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  847. }
  848. $error = error_get_last();
  849. if (isset($error['message'])) {
  850. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  851. }
  852. throw new \RuntimeException(sprintf($message, $path));
  853. }
  854. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  855. return array();
  856. }
  857. $contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
  858. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  859. if (substr($contents, 0, 2) !== '<?') {
  860. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  861. if ($replacements === 0) {
  862. return array();
  863. }
  864. }
  865. $contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
  866. $pos = strrpos($contents, '?>');
  867. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  868. $contents = substr($contents, 0, $pos);
  869. }
  870. preg_match_all('{
  871. (?:
  872. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  873. | \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*+ [\{;]
  874. )
  875. }ix', $contents, $matches);
  876. $classes = array();
  877. $namespace = '';
  878. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  879. if (!empty($matches['ns'][$i])) {
  880. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  881. } else {
  882. $name = $matches['name'][$i];
  883. if ($name === 'extends' || $name === 'implements') {
  884. continue;
  885. }
  886. if ($name[0] === ':') {
  887. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  888. } elseif ($matches['type'][$i] === 'enum') {
  889. $name = rtrim($name, ':');
  890. }
  891. $classes[] = ltrim($namespace . $name, '\\');
  892. }
  893. }
  894. return $classes;
  895. }
  896. }
  897. <?php
  898. namespace Composer;
  899. use Composer\IO\IOInterface;
  900. use Composer\Util\Filesystem;
  901. use Composer\Util\Silencer;
  902. use Symfony\Component\Finder\Finder;
  903. class Cache
  904. {
  905. private static $cacheCollected = false;
  906. private $io;
  907. private $root;
  908. private $enabled = true;
  909. private $whitelist;
  910. private $filesystem;
  911. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  912. {
  913. $this->io = $io;
  914. $this->root = rtrim($cacheDir, '/\\') . '/';
  915. $this->whitelist = $whitelist;
  916. $this->filesystem = $filesystem ?: new Filesystem();
  917. if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
  918. $this->enabled = false;
  919. return;
  920. }
  921. if (
  922. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  923. || !is_writable($this->root)
  924. ) {
  925. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  926. $this->enabled = false;
  927. }
  928. }
  929. public function isEnabled()
  930. {
  931. return $this->enabled;
  932. }
  933. public function getRoot()
  934. {
  935. return $this->root;
  936. }
  937. public function read($file)
  938. {
  939. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  940. if ($this->enabled && file_exists($this->root . $file)) {
  941. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  942. return file_get_contents($this->root . $file);
  943. }
  944. return false;
  945. }
  946. public function write($file, $contents)
  947. {
  948. if ($this->enabled) {
  949. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  950. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  951. try {
  952. return file_put_contents($this->root . $file, $contents);
  953. } catch (\ErrorException $e) {
  954. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  955. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  956. unlink($this->root . $file);
  957. $message = sprintf(
  958. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  959. $this->root . $file,
  960. $m[1],
  961. $m[2],
  962. @disk_free_space($this->root . dirname($file))
  963. );
  964. $this->io->writeError($message);
  965. return false;
  966. }
  967. throw $e;
  968. }
  969. }
  970. return false;
  971. }
  972. public function copyFrom($file, $source)
  973. {
  974. if ($this->enabled) {
  975. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  976. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  977. if (!file_exists($source)) {
  978. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  979. } elseif ($this->io->isDebug()) {
  980. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  981. }
  982. return copy($source, $this->root . $file);
  983. }
  984. return false;
  985. }
  986. public function copyTo($file, $target)
  987. {
  988. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  989. if ($this->enabled && file_exists($this->root . $file)) {
  990. try {
  991. touch($this->root . $file, filemtime($this->root . $file), time());
  992. } catch (\ErrorException $e) {
  993. Silencer::call('touch', $this->root . $file);
  994. }
  995. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  996. return copy($this->root . $file, $target);
  997. }
  998. return false;
  999. }
  1000. public function gcIsNecessary()
  1001. {
  1002. return (!self::$cacheCollected && !mt_rand(0, 50));
  1003. }
  1004. public function remove($file)
  1005. {
  1006. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1007. if ($this->enabled && file_exists($this->root . $file)) {
  1008. return $this->filesystem->unlink($this->root . $file);
  1009. }
  1010. return false;
  1011. }
  1012. public function clear()
  1013. {
  1014. if ($this->enabled) {
  1015. return $this->filesystem->removeDirectory($this->root);
  1016. }
  1017. return false;
  1018. }
  1019. public function gc($ttl, $maxSize)
  1020. {
  1021. if ($this->enabled) {
  1022. $expire = new \DateTime();
  1023. $expire->modify('-'.$ttl.' seconds');
  1024. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1025. foreach ($finder as $file) {
  1026. $this->filesystem->unlink($file->getPathname());
  1027. }
  1028. $totalSize = $this->filesystem->size($this->root);
  1029. if ($totalSize > $maxSize) {
  1030. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1031. while ($totalSize > $maxSize && $iterator->valid()) {
  1032. $filepath = $iterator->current()->getPathname();
  1033. $totalSize -= $this->filesystem->size($filepath);
  1034. $this->filesystem->unlink($filepath);
  1035. $iterator->next();
  1036. }
  1037. }
  1038. self::$cacheCollected = true;
  1039. return true;
  1040. }
  1041. return false;
  1042. }
  1043. public function sha1($file)
  1044. {
  1045. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1046. if ($this->enabled && file_exists($this->root . $file)) {
  1047. return sha1_file($this->root . $file);
  1048. }
  1049. return false;
  1050. }
  1051. public function sha256($file)
  1052. {
  1053. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1054. if ($this->enabled && file_exists($this->root . $file)) {
  1055. return hash_file('sha256', $this->root . $file);
  1056. }
  1057. return false;
  1058. }
  1059. protected function getFinder()
  1060. {
  1061. return Finder::create()->in($this->root)->files();
  1062. }
  1063. }
  1064. <?php
  1065. namespace Composer\Command;
  1066. use Symfony\Component\Console\Input\InputInterface;
  1067. use Symfony\Component\Console\Output\OutputInterface;
  1068. class AboutCommand extends BaseCommand
  1069. {
  1070. protected function configure()
  1071. {
  1072. $this
  1073. ->setName('about')
  1074. ->setDescription('Shows the short information about Composer.')
  1075. ->setHelp(<<<EOT
  1076. <info>php composer.phar about</info>
  1077. EOT
  1078. )
  1079. ;
  1080. }
  1081. protected function execute(InputInterface $input, OutputInterface $output)
  1082. {
  1083. $this->getIO()->write(<<<EOT
  1084. <info>Composer - Package Management for PHP</info>
  1085. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1086. See https://getcomposer.org/ for more information.</comment>
  1087. EOT
  1088. );
  1089. }
  1090. }
  1091. <?php
  1092. namespace Composer\Command;
  1093. use Composer\Factory;
  1094. use Composer\IO\IOInterface;
  1095. use Composer\Config;
  1096. use Composer\Composer;
  1097. use Composer\Repository\CompositeRepository;
  1098. use Composer\Repository\RepositoryFactory;
  1099. use Composer\Script\ScriptEvents;
  1100. use Composer\Plugin\CommandEvent;
  1101. use Composer\Plugin\PluginEvents;
  1102. use Composer\Util\Filesystem;
  1103. use Symfony\Component\Console\Input\InputArgument;
  1104. use Symfony\Component\Console\Input\InputInterface;
  1105. use Symfony\Component\Console\Input\InputOption;
  1106. use Symfony\Component\Console\Output\OutputInterface;
  1107. class ArchiveCommand extends BaseCommand
  1108. {
  1109. protected function configure()
  1110. {
  1111. $this
  1112. ->setName('archive')
  1113. ->setDescription('Creates an archive of this composer package.')
  1114. ->setDefinition(array(
  1115. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1116. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1117. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1118. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1119. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1120. .' Note that the format will be appended.'),
  1121. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1122. ))
  1123. ->setHelp(<<<EOT
  1124. The <info>archive</info> command creates an archive of the specified format
  1125. containing the files and directories of the Composer project or the specified
  1126. package in the specified version and writes it to the specified directory.
  1127. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1128. EOT
  1129. )
  1130. ;
  1131. }
  1132. protected function execute(InputInterface $input, OutputInterface $output)
  1133. {
  1134. $config = Factory::createConfig();
  1135. $composer = $this->getComposer(false);
  1136. if ($composer) {
  1137. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1138. $eventDispatcher = $composer->getEventDispatcher();
  1139. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1140. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1141. }
  1142. if (null === $input->getOption('format')) {
  1143. $input->setOption('format', $config->get('archive-format'));
  1144. }
  1145. if (null === $input->getOption('dir')) {
  1146. $input->setOption('dir', $config->get('archive-dir'));
  1147. }
  1148. $returnCode = $this->archive(
  1149. $this->getIO(),
  1150. $config,
  1151. $input->getArgument('package'),
  1152. $input->getArgument('version'),
  1153. $input->getOption('format'),
  1154. $input->getOption('dir'),
  1155. $input->getOption('file'),
  1156. $input->getOption('ignore-filters'),
  1157. $composer
  1158. );
  1159. if (0 === $returnCode && $composer) {
  1160. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1161. }
  1162. return $returnCode;
  1163. }
  1164. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1165. {
  1166. if ($composer) {
  1167. $archiveManager = $composer->getArchiveManager();
  1168. } else {
  1169. $factory = new Factory;
  1170. $downloadManager = $factory->createDownloadManager($io, $config);
  1171. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1172. }
  1173. if ($packageName) {
  1174. $package = $this->selectPackage($io, $packageName, $version);
  1175. if (!$package) {
  1176. return 1;
  1177. }
  1178. } else {
  1179. $package = $this->getComposer()->getPackage();
  1180. }
  1181. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1182. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1183. $fs = new Filesystem;
  1184. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1185. $io->writeError('Created: ', false);
  1186. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1187. return 0;
  1188. }
  1189. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1190. {
  1191. $io->writeError('<info>Searching for the specified package.</info>');
  1192. if ($composer = $this->getComposer(false)) {
  1193. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1194. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1195. } else {
  1196. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1197. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1198. $repo = new CompositeRepository($defaultRepos);
  1199. }
  1200. $packages = $repo->findPackages($packageName, $version);
  1201. if (count($packages) > 1) {
  1202. $package = reset($packages);
  1203. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1204. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1205. return $p->getPrettyString();
  1206. }, $packages)).'.');
  1207. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1208. } elseif ($packages) {
  1209. $package = reset($packages);
  1210. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1211. } else {
  1212. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1213. return false;
  1214. }
  1215. return $package;
  1216. }
  1217. }
  1218. <?php
  1219. namespace Composer\Command;
  1220. use Composer\Composer;
  1221. use Composer\Config;
  1222. use Composer\Console\Application;
  1223. use Composer\Factory;
  1224. use Composer\IO\IOInterface;
  1225. use Composer\IO\NullIO;
  1226. use Composer\Plugin\PreCommandRunEvent;
  1227. use Composer\Plugin\PluginEvents;
  1228. use Symfony\Component\Console\Input\InputInterface;
  1229. use Symfony\Component\Console\Output\OutputInterface;
  1230. use Symfony\Component\Console\Command\Command;
  1231. abstract class BaseCommand extends Command
  1232. {
  1233. private $composer;
  1234. private $io;
  1235. public function getComposer($required = true, $disablePlugins = null)
  1236. {
  1237. if (null === $this->composer) {
  1238. $application = $this->getApplication();
  1239. if ($application instanceof Application) {
  1240. $this->composer = $application->getComposer($required, $disablePlugins);
  1241. } elseif ($required) {
  1242. throw new \RuntimeException(
  1243. 'Could not create a Composer\Composer instance, you must inject '.
  1244. 'one if this command is not used with a Composer\Console\Application instance'
  1245. );
  1246. }
  1247. }
  1248. return $this->composer;
  1249. }
  1250. public function setComposer(Composer $composer)
  1251. {
  1252. $this->composer = $composer;
  1253. }
  1254. public function resetComposer()
  1255. {
  1256. $this->composer = null;
  1257. $this->getApplication()->resetComposer();
  1258. }
  1259. public function isProxyCommand()
  1260. {
  1261. return false;
  1262. }
  1263. public function getIO()
  1264. {
  1265. if (null === $this->io) {
  1266. $application = $this->getApplication();
  1267. if ($application instanceof Application) {
  1268. $this->io = $application->getIO();
  1269. } else {
  1270. $this->io = new NullIO();
  1271. }
  1272. }
  1273. return $this->io;
  1274. }
  1275. public function setIO(IOInterface $io)
  1276. {
  1277. $this->io = $io;
  1278. }
  1279. protected function initialize(InputInterface $input, OutputInterface $output)
  1280. {
  1281. $composer = $this->getComposer(false, false);
  1282. if (null === $composer) {
  1283. $composer = Factory::createGlobal($this->getIO(), false);
  1284. }
  1285. if ($composer) {
  1286. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1287. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1288. }
  1289. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1290. $input->setOption('no-progress', true);
  1291. }
  1292. parent::initialize($input, $output);
  1293. }
  1294. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1295. {
  1296. $preferSource = false;
  1297. $preferDist = false;
  1298. switch ($config->get('preferred-install')) {
  1299. case 'source':
  1300. $preferSource = true;
  1301. break;
  1302. case 'dist':
  1303. $preferDist = true;
  1304. break;
  1305. case 'auto':
  1306. default:
  1307. break;
  1308. }
  1309. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1310. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1311. $preferDist = $input->getOption('prefer-dist');
  1312. }
  1313. return array($preferSource, $preferDist);
  1314. }
  1315. }
  1316. <?php
  1317. namespace Composer\Command;
  1318. use Composer\DependencyResolver\Pool;
  1319. use Composer\Package\Link;
  1320. use Composer\Package\PackageInterface;
  1321. use Composer\Repository\ArrayRepository;
  1322. use Composer\Repository\CompositeRepository;
  1323. use Composer\Repository\PlatformRepository;
  1324. use Composer\Repository\RepositoryFactory;
  1325. use Composer\Plugin\CommandEvent;
  1326. use Composer\Plugin\PluginEvents;
  1327. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1328. use Composer\Package\Version\VersionParser;
  1329. use Symfony\Component\Console\Helper\Table;
  1330. use Symfony\Component\Console\Input\InputArgument;
  1331. use Symfony\Component\Console\Input\InputInterface;
  1332. use Symfony\Component\Console\Input\InputOption;
  1333. use Symfony\Component\Console\Output\OutputInterface;
  1334. class BaseDependencyCommand extends BaseCommand
  1335. {
  1336. const ARGUMENT_PACKAGE = 'package';
  1337. const ARGUMENT_CONSTRAINT = 'constraint';
  1338. const OPTION_RECURSIVE = 'recursive';
  1339. const OPTION_TREE = 'tree';
  1340. protected $colors;
  1341. protected function configure()
  1342. {
  1343. $this->setDefinition(array(
  1344. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1345. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1346. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1347. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1348. ));
  1349. }
  1350. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1351. {
  1352. $composer = $this->getComposer();
  1353. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1354. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1355. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1356. $repository = new CompositeRepository(array(
  1357. new ArrayRepository(array($composer->getPackage())),
  1358. $composer->getRepositoryManager()->getLocalRepository(),
  1359. new PlatformRepository(array(), $platformOverrides),
  1360. ));
  1361. $pool = new Pool();
  1362. $pool->addRepository($repository);
  1363. list($needle, $textConstraint) = array_pad(
  1364. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1365. 2,
  1366. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1367. );
  1368. $packages = $pool->whatProvides($needle);
  1369. if (empty($packages)) {
  1370. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1371. }
  1372. if (!$repository->findPackage($needle, $textConstraint)) {
  1373. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1374. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1375. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1376. }
  1377. }
  1378. $needles = array($needle);
  1379. if ($inverted) {
  1380. foreach ($packages as $package) {
  1381. $needles = array_merge($needles, array_map(function (Link $link) {
  1382. return $link->getTarget();
  1383. }, $package->getReplaces()));
  1384. }
  1385. }
  1386. if ('*' !== $textConstraint) {
  1387. $versionParser = new VersionParser();
  1388. $constraint = $versionParser->parseConstraints($textConstraint);
  1389. } else {
  1390. $constraint = null;
  1391. }
  1392. $renderTree = $input->getOption(self::OPTION_TREE);
  1393. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1394. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1395. if (empty($results)) {
  1396. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1397. $this->getIO()->writeError(sprintf('<info>There is no installed package depending on "%s"%s</info>',
  1398. $needle, $extra));
  1399. } elseif ($renderTree) {
  1400. $this->initStyles($output);
  1401. $root = $packages[0];
  1402. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1403. $this->printTree($results);
  1404. } else {
  1405. $this->printTable($output, $results);
  1406. }
  1407. return 0;
  1408. }
  1409. protected function printTable(OutputInterface $output, $results)
  1410. {
  1411. $table = array();
  1412. $doubles = array();
  1413. do {
  1414. $queue = array();
  1415. $rows = array();
  1416. foreach ($results as $result) {
  1417. list($package, $link, $children) = $result;
  1418. $unique = (string) $link;
  1419. if (isset($doubles[$unique])) {
  1420. continue;
  1421. }
  1422. $doubles[$unique] = true;
  1423. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1424. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1425. if ($children) {
  1426. $queue = array_merge($queue, $children);
  1427. }
  1428. }
  1429. $results = $queue;
  1430. $table = array_merge($rows, $table);
  1431. } while (!empty($results));
  1432. $renderer = new Table($output);
  1433. $renderer->setStyle('compact');
  1434. $rendererStyle = $renderer->getStyle();
  1435. $rendererStyle->setVerticalBorderChar('');
  1436. $rendererStyle->setCellRowContentFormat('%s ');
  1437. $renderer->setRows($table)->render();
  1438. }
  1439. protected function initStyles(OutputInterface $output)
  1440. {
  1441. $this->colors = array(
  1442. 'green',
  1443. 'yellow',
  1444. 'cyan',
  1445. 'magenta',
  1446. 'blue',
  1447. );
  1448. foreach ($this->colors as $color) {
  1449. $style = new OutputFormatterStyle($color);
  1450. $output->getFormatter()->setStyle($color, $style);
  1451. }
  1452. }
  1453. protected function printTree($results, $prefix = '', $level = 1)
  1454. {
  1455. $count = count($results);
  1456. $idx = 0;
  1457. foreach ($results as $result) {
  1458. list($package, $link, $children) = $result;
  1459. $color = $this->colors[$level % count($this->colors)];
  1460. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1461. $isLast = (++$idx == $count);
  1462. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1463. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1464. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1465. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1466. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1467. if ($children) {
  1468. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1469. }
  1470. }
  1471. }
  1472. private function writeTreeLine($line)
  1473. {
  1474. $io = $this->getIO();
  1475. if (!$io->isDecorated()) {
  1476. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1477. }
  1478. $io->write($line);
  1479. }
  1480. }
  1481. <?php
  1482. namespace Composer\Command;
  1483. use Composer\Package\Link;
  1484. use Composer\Package\PackageInterface;
  1485. use Composer\Semver\Constraint\Constraint;
  1486. use Symfony\Component\Console\Helper\Table;
  1487. use Symfony\Component\Console\Input\InputInterface;
  1488. use Symfony\Component\Console\Output\OutputInterface;
  1489. use Composer\Repository\PlatformRepository;
  1490. class CheckPlatformReqsCommand extends BaseCommand
  1491. {
  1492. protected function configure()
  1493. {
  1494. $this->setName('check-platform-reqs')
  1495. ->setDescription('Check that platform requirements are satisfied.')
  1496. ->setHelp(<<<EOT
  1497. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1498. <info>php composer.phar check-platform-reqs</info>
  1499. EOT
  1500. );
  1501. }
  1502. protected function execute(InputInterface $input, OutputInterface $output)
  1503. {
  1504. $composer = $this->getComposer();
  1505. $repos = $composer->getRepositoryManager()->getLocalRepository();
  1506. $allPackages = array_merge(array($composer->getPackage()), $repos->getPackages());
  1507. $requires = $composer->getPackage()->getDevRequires();
  1508. foreach ($requires as $require => $link) {
  1509. $requires[$require] = array($link);
  1510. }
  1511. foreach ($allPackages as $package) {
  1512. foreach ($package->getRequires() as $require => $link) {
  1513. $requires[$require][] = $link;
  1514. }
  1515. }
  1516. ksort($requires);
  1517. $platformRepo = new PlatformRepository(array(), array());
  1518. $currentPlatformPackages = $platformRepo->getPackages();
  1519. $currentPlatformPackageMap = array();
  1520. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1521. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1522. }
  1523. $results = array();
  1524. $exitCode = 0;
  1525. foreach ($requires as $require => $links) {
  1526. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1527. if (isset($currentPlatformPackageMap[$require])) {
  1528. $pass = true;
  1529. $version = $currentPlatformPackageMap[$require]->getVersion();
  1530. foreach ($links as $link) {
  1531. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1532. $results[] = array(
  1533. $currentPlatformPackageMap[$require]->getPrettyName(),
  1534. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1535. $link,
  1536. '<error>failed</error>',
  1537. );
  1538. $pass = false;
  1539. $exitCode = max($exitCode, 1);
  1540. }
  1541. }
  1542. if ($pass) {
  1543. $results[] = array(
  1544. $currentPlatformPackageMap[$require]->getPrettyName(),
  1545. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1546. null,
  1547. '<info>success</info>',
  1548. );
  1549. }
  1550. } else {
  1551. $results[] = array(
  1552. $require,
  1553. 'n/a',
  1554. $links[0],
  1555. '<error>missing</error>',
  1556. );
  1557. $exitCode = max($exitCode, 2);
  1558. }
  1559. }
  1560. }
  1561. $this->printTable($output, $results);
  1562. return $exitCode;
  1563. }
  1564. protected function printTable(OutputInterface $output, $results)
  1565. {
  1566. $table = array();
  1567. $rows = array();
  1568. foreach ($results as $result) {
  1569. list($platformPackage, $version, $link, $status) = $result;
  1570. $rows[] = array(
  1571. $platformPackage,
  1572. $version,
  1573. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1574. $status,
  1575. );
  1576. }
  1577. $table = array_merge($rows, $table);
  1578. $renderer = new Table($output);
  1579. $renderer->setStyle('compact');
  1580. $rendererStyle = $renderer->getStyle();
  1581. $rendererStyle->setVerticalBorderChar('');
  1582. $rendererStyle->setCellRowContentFormat('%s ');
  1583. $renderer->setRows($table)->render();
  1584. }
  1585. }
  1586. <?php
  1587. namespace Composer\Command;
  1588. use Composer\Cache;
  1589. use Composer\Factory;
  1590. use Symfony\Component\Console\Input\InputInterface;
  1591. use Symfony\Component\Console\Output\OutputInterface;
  1592. class ClearCacheCommand extends BaseCommand
  1593. {
  1594. protected function configure()
  1595. {
  1596. $this
  1597. ->setName('clear-cache')
  1598. ->setAliases(array('clearcache'))
  1599. ->setDescription('Clears composer\'s internal package cache.')
  1600. ->setHelp(<<<EOT
  1601. The <info>clear-cache</info> deletes all cached packages from composer's
  1602. cache directory.
  1603. EOT
  1604. )
  1605. ;
  1606. }
  1607. protected function execute(InputInterface $input, OutputInterface $output)
  1608. {
  1609. $config = Factory::createConfig();
  1610. $io = $this->getIO();
  1611. $cachePaths = array(
  1612. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1613. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1614. 'cache-files-dir' => $config->get('cache-files-dir'),
  1615. 'cache-dir' => $config->get('cache-dir'),
  1616. );
  1617. foreach ($cachePaths as $key => $cachePath) {
  1618. $cachePath = realpath($cachePath);
  1619. if (!$cachePath) {
  1620. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1621. continue;
  1622. }
  1623. $cache = new Cache($io, $cachePath);
  1624. if (!$cache->isEnabled()) {
  1625. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1626. continue;
  1627. }
  1628. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1629. $cache->clear();
  1630. }
  1631. $io->writeError('<info>All caches cleared.</info>');
  1632. }
  1633. }
  1634. <?php
  1635. namespace Composer\Command;
  1636. use Composer\Util\Platform;
  1637. use Composer\Util\Silencer;
  1638. use Symfony\Component\Console\Input\InputInterface;
  1639. use Symfony\Component\Console\Input\InputArgument;
  1640. use Symfony\Component\Console\Input\InputOption;
  1641. use Symfony\Component\Console\Output\OutputInterface;
  1642. use Composer\Config;
  1643. use Composer\Config\JsonConfigSource;
  1644. use Composer\Factory;
  1645. use Composer\Json\JsonFile;
  1646. use Composer\Semver\VersionParser;
  1647. use Composer\Package\BasePackage;
  1648. class ConfigCommand extends BaseCommand
  1649. {
  1650. protected $config;
  1651. protected $configFile;
  1652. protected $configSource;
  1653. protected $authConfigFile;
  1654. protected $authConfigSource;
  1655. protected function configure()
  1656. {
  1657. $this
  1658. ->setName('config')
  1659. ->setDescription('Sets config options.')
  1660. ->setDefinition(array(
  1661. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1662. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1663. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1664. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1665. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1666. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1667. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1668. new InputArgument('setting-key', null, 'Setting key'),
  1669. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1670. ))
  1671. ->setHelp(<<<EOT
  1672. This command allows you to edit composer config settings and repositories
  1673. in either the local composer.json file or the global config.json file.
  1674. Additionally it lets you edit most properties in the local composer.json.
  1675. To set a config setting:
  1676. <comment>%command.full_name% bin-dir bin/</comment>
  1677. To read a config setting:
  1678. <comment>%command.full_name% bin-dir</comment>
  1679. Outputs: <info>bin</info>
  1680. To edit the global config.json file:
  1681. <comment>%command.full_name% --global</comment>
  1682. To add a repository:
  1683. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1684. To remove a repository (repo is a short alias for repositories):
  1685. <comment>%command.full_name% --unset repo.foo</comment>
  1686. To disable packagist:
  1687. <comment>%command.full_name% repo.packagist false</comment>
  1688. You can alter repositories in the global config.json file by passing in the
  1689. <info>--global</info> option.
  1690. To edit the file in an external editor:
  1691. <comment>%command.full_name% --editor</comment>
  1692. To choose your editor you can set the "EDITOR" env variable.
  1693. To get a list of configuration values in the file:
  1694. <comment>%command.full_name% --list</comment>
  1695. You can always pass more than one option. As an example, if you want to edit the
  1696. global config.json file.
  1697. <comment>%command.full_name% --editor --global</comment>
  1698. EOT
  1699. )
  1700. ;
  1701. }
  1702. protected function initialize(InputInterface $input, OutputInterface $output)
  1703. {
  1704. parent::initialize($input, $output);
  1705. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1706. throw new \RuntimeException('--file and --global can not be combined');
  1707. }
  1708. $io = $this->getIO();
  1709. $this->config = Factory::createConfig($io);
  1710. $configFile = $input->getOption('global')
  1711. ? ($this->config->get('home') . '/config.json')
  1712. : ($input->getOption('file') ?: Factory::getComposerFile());
  1713. if (
  1714. ($configFile === 'composer.json' || $configFile === './composer.json')
  1715. && !file_exists($configFile)
  1716. && realpath(getcwd()) === realpath($this->config->get('home'))
  1717. ) {
  1718. file_put_contents($configFile, "{\n}\n");
  1719. }
  1720. $this->configFile = new JsonFile($configFile, null, $io);
  1721. $this->configSource = new JsonConfigSource($this->configFile);
  1722. $authConfigFile = $input->getOption('global')
  1723. ? ($this->config->get('home') . '/auth.json')
  1724. : dirname(realpath($configFile)) . '/auth.json';
  1725. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1726. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1727. if ($input->getOption('global') && !$this->configFile->exists()) {
  1728. touch($this->configFile->getPath());
  1729. $this->configFile->write(array('config' => new \ArrayObject));
  1730. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1731. }
  1732. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1733. touch($this->authConfigFile->getPath());
  1734. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1735. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1736. }
  1737. if (!$this->configFile->exists()) {
  1738. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1739. }
  1740. }
  1741. protected function execute(InputInterface $input, OutputInterface $output)
  1742. {
  1743. if ($input->getOption('editor')) {
  1744. $editor = escapeshellcmd(getenv('EDITOR'));
  1745. if (!$editor) {
  1746. if (Platform::isWindows()) {
  1747. $editor = 'notepad';
  1748. } else {
  1749. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1750. if (exec('which '.$candidate)) {
  1751. $editor = $candidate;
  1752. break;
  1753. }
  1754. }
  1755. }
  1756. }
  1757. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1758. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1759. return 0;
  1760. }
  1761. if (!$input->getOption('global')) {
  1762. $this->config->merge($this->configFile->read());
  1763. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1764. }
  1765. if ($input->getOption('list')) {
  1766. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1767. return 0;
  1768. }
  1769. $settingKey = $input->getArgument('setting-key');
  1770. if (!$settingKey) {
  1771. return 0;
  1772. }
  1773. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1774. throw new \RuntimeException('You can not combine a setting value with --unset');
  1775. }
  1776. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1777. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1778. $rawData = $this->configFile->read();
  1779. $data = $this->config->all();
  1780. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1781. if (!isset($matches[1]) || $matches[1] === '') {
  1782. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1783. } else {
  1784. if (!isset($data['repositories'][$matches[1]])) {
  1785. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1786. }
  1787. $value = $data['repositories'][$matches[1]];
  1788. }
  1789. } elseif (strpos($settingKey, '.')) {
  1790. $bits = explode('.', $settingKey);
  1791. if ($bits[0] === 'extra') {
  1792. $data = $rawData;
  1793. } else {
  1794. $data = $data['config'];
  1795. }
  1796. $match = false;
  1797. foreach ($bits as $bit) {
  1798. $key = isset($key) ? $key.'.'.$bit : $bit;
  1799. $match = false;
  1800. if (isset($data[$key])) {
  1801. $match = true;
  1802. $data = $data[$key];
  1803. unset($key);
  1804. }
  1805. }
  1806. if (!$match) {
  1807. throw new \RuntimeException($settingKey.' is not defined.');
  1808. }
  1809. $value = $data;
  1810. } elseif (isset($data['config'][$settingKey])) {
  1811. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1812. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1813. $value = $rawData[$settingKey];
  1814. } else {
  1815. throw new \RuntimeException($settingKey.' is not defined');
  1816. }
  1817. if (is_array($value)) {
  1818. $value = json_encode($value);
  1819. }
  1820. $this->getIO()->write($value);
  1821. return 0;
  1822. }
  1823. $values = $input->getArgument('setting-value');
  1824. $booleanValidator = function ($val) {
  1825. return in_array($val, array('true', 'false', '1', '0'), true);
  1826. };
  1827. $booleanNormalizer = function ($val) {
  1828. return $val !== 'false' && (bool) $val;
  1829. };
  1830. $uniqueConfigValues = array(
  1831. 'process-timeout' => array('is_numeric', 'intval'),
  1832. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1833. 'preferred-install' => array(
  1834. function ($val) {
  1835. return in_array($val, array('auto', 'source', 'dist'), true);
  1836. },
  1837. function ($val) {
  1838. return $val;
  1839. },
  1840. ),
  1841. 'store-auths' => array(
  1842. function ($val) {
  1843. return in_array($val, array('true', 'false', 'prompt'), true);
  1844. },
  1845. function ($val) {
  1846. if ('prompt' === $val) {
  1847. return 'prompt';
  1848. }
  1849. return $val !== 'false' && (bool) $val;
  1850. },
  1851. ),
  1852. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1853. 'vendor-dir' => array('is_string', function ($val) {
  1854. return $val;
  1855. }),
  1856. 'bin-dir' => array('is_string', function ($val) {
  1857. return $val;
  1858. }),
  1859. 'archive-dir' => array('is_string', function ($val) {
  1860. return $val;
  1861. }),
  1862. 'archive-format' => array('is_string', function ($val) {
  1863. return $val;
  1864. }),
  1865. 'data-dir' => array('is_string', function ($val) {
  1866. return $val;
  1867. }),
  1868. 'cache-dir' => array('is_string', function ($val) {
  1869. return $val;
  1870. }),
  1871. 'cache-files-dir' => array('is_string', function ($val) {
  1872. return $val;
  1873. }),
  1874. 'cache-repo-dir' => array('is_string', function ($val) {
  1875. return $val;
  1876. }),
  1877. 'cache-vcs-dir' => array('is_string', function ($val) {
  1878. return $val;
  1879. }),
  1880. 'cache-ttl' => array('is_numeric', 'intval'),
  1881. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1882. 'cache-files-maxsize' => array(
  1883. function ($val) {
  1884. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  1885. },
  1886. function ($val) {
  1887. return $val;
  1888. },
  1889. ),
  1890. 'bin-compat' => array(
  1891. function ($val) {
  1892. return in_array($val, array('auto', 'full'));
  1893. },
  1894. function ($val) {
  1895. return $val;
  1896. },
  1897. ),
  1898. 'discard-changes' => array(
  1899. function ($val) {
  1900. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  1901. },
  1902. function ($val) {
  1903. if ('stash' === $val) {
  1904. return 'stash';
  1905. }
  1906. return $val !== 'false' && (bool) $val;
  1907. },
  1908. ),
  1909. 'autoloader-suffix' => array('is_string', function ($val) {
  1910. return $val === 'null' ? null : $val;
  1911. }),
  1912. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1913. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1914. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1915. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  1916. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1917. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1918. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  1919. 'cafile' => array(
  1920. function ($val) {
  1921. return file_exists($val) && is_readable($val);
  1922. },
  1923. function ($val) {
  1924. return $val === 'null' ? null : $val;
  1925. },
  1926. ),
  1927. 'capath' => array(
  1928. function ($val) {
  1929. return is_dir($val) && is_readable($val);
  1930. },
  1931. function ($val) {
  1932. return $val === 'null' ? null : $val;
  1933. },
  1934. ),
  1935. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  1936. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  1937. );
  1938. $multiConfigValues = array(
  1939. 'github-protocols' => array(
  1940. function ($vals) {
  1941. if (!is_array($vals)) {
  1942. return 'array expected';
  1943. }
  1944. foreach ($vals as $val) {
  1945. if (!in_array($val, array('git', 'https', 'ssh'))) {
  1946. return 'valid protocols include: git, https, ssh';
  1947. }
  1948. }
  1949. return true;
  1950. },
  1951. function ($vals) {
  1952. return $vals;
  1953. },
  1954. ),
  1955. 'github-domains' => array(
  1956. function ($vals) {
  1957. if (!is_array($vals)) {
  1958. return 'array expected';
  1959. }
  1960. return true;
  1961. },
  1962. function ($vals) {
  1963. return $vals;
  1964. },
  1965. ),
  1966. 'gitlab-domains' => array(
  1967. function ($vals) {
  1968. if (!is_array($vals)) {
  1969. return 'array expected';
  1970. }
  1971. return true;
  1972. },
  1973. function ($vals) {
  1974. return $vals;
  1975. },
  1976. ),
  1977. );
  1978. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  1979. return $this->configSource->removeConfigSetting($settingKey);
  1980. }
  1981. if (isset($uniqueConfigValues[$settingKey])) {
  1982. return $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  1983. }
  1984. if (isset($multiConfigValues[$settingKey])) {
  1985. return $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  1986. }
  1987. $uniqueProps = array(
  1988. 'name' => array('is_string', function ($val) {
  1989. return $val;
  1990. }),
  1991. 'type' => array('is_string', function ($val) {
  1992. return $val;
  1993. }),
  1994. 'description' => array('is_string', function ($val) {
  1995. return $val;
  1996. }),
  1997. 'homepage' => array('is_string', function ($val) {
  1998. return $val;
  1999. }),
  2000. 'version' => array('is_string', function ($val) {
  2001. return $val;
  2002. }),
  2003. 'minimum-stability' => array(
  2004. function ($val) {
  2005. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2006. },
  2007. function ($val) {
  2008. return VersionParser::normalizeStability($val);
  2009. },
  2010. ),
  2011. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2012. );
  2013. $multiProps = array(
  2014. 'keywords' => array(
  2015. function ($vals) {
  2016. if (!is_array($vals)) {
  2017. return 'array expected';
  2018. }
  2019. return true;
  2020. },
  2021. function ($vals) {
  2022. return $vals;
  2023. },
  2024. ),
  2025. 'license' => array(
  2026. function ($vals) {
  2027. if (!is_array($vals)) {
  2028. return 'array expected';
  2029. }
  2030. return true;
  2031. },
  2032. function ($vals) {
  2033. return $vals;
  2034. },
  2035. ),
  2036. );
  2037. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2038. 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');
  2039. }
  2040. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2041. return $this->configSource->removeProperty($settingKey);
  2042. }
  2043. if (isset($uniqueProps[$settingKey])) {
  2044. return $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2045. }
  2046. if (isset($multiProps[$settingKey])) {
  2047. return $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2048. }
  2049. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2050. if ($input->getOption('unset')) {
  2051. return $this->configSource->removeRepository($matches[1]);
  2052. }
  2053. if (2 === count($values)) {
  2054. return $this->configSource->addRepository($matches[1], array(
  2055. 'type' => $values[0],
  2056. 'url' => $values[1],
  2057. ));
  2058. }
  2059. if (1 === count($values)) {
  2060. $value = strtolower($values[0]);
  2061. if (true === $booleanValidator($value)) {
  2062. if (false === $booleanNormalizer($value)) {
  2063. return $this->configSource->addRepository($matches[1], false);
  2064. }
  2065. } else {
  2066. $value = JsonFile::parseJson($values[0]);
  2067. return $this->configSource->addRepository($matches[1], $value);
  2068. }
  2069. }
  2070. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2071. }
  2072. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2073. if ($input->getOption('unset')) {
  2074. return $this->configSource->removeProperty($settingKey);
  2075. }
  2076. return $this->configSource->addProperty($settingKey, $values[0]);
  2077. }
  2078. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2079. if ($input->getOption('unset')) {
  2080. return $this->configSource->removeConfigSetting($settingKey);
  2081. }
  2082. return $this->configSource->addConfigSetting($settingKey, $values[0]);
  2083. }
  2084. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2085. return $this->configSource->removeConfigSetting($settingKey);
  2086. }
  2087. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
  2088. if ($input->getOption('unset')) {
  2089. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2090. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2091. return;
  2092. }
  2093. if ($matches[1] === 'bitbucket-oauth') {
  2094. if (2 !== count($values)) {
  2095. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2096. }
  2097. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2098. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2099. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
  2100. if (1 !== count($values)) {
  2101. throw new \RuntimeException('Too many arguments, expected only one token');
  2102. }
  2103. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2104. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2105. } elseif ($matches[1] === 'http-basic') {
  2106. if (2 !== count($values)) {
  2107. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2108. }
  2109. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2110. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2111. }
  2112. return;
  2113. }
  2114. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2115. }
  2116. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2117. {
  2118. list($validator, $normalizer) = $callbacks;
  2119. if (1 !== count($values)) {
  2120. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2121. }
  2122. if (true !== $validation = $validator($values[0])) {
  2123. throw new \RuntimeException(sprintf(
  2124. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2125. $values[0]
  2126. ));
  2127. }
  2128. return call_user_func(array($this->configSource, $method), $key, $normalizer($values[0]));
  2129. }
  2130. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2131. {
  2132. list($validator, $normalizer) = $callbacks;
  2133. if (true !== $validation = $validator($values)) {
  2134. throw new \RuntimeException(sprintf(
  2135. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2136. json_encode($values)
  2137. ));
  2138. }
  2139. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2140. }
  2141. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2142. {
  2143. $origK = $k;
  2144. $io = $this->getIO();
  2145. foreach ($contents as $key => $value) {
  2146. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2147. continue;
  2148. }
  2149. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2150. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2151. $k .= preg_replace('{^config\.}', '', $key . '.');
  2152. $this->listConfiguration($value, $rawVal, $output, $k);
  2153. $k = $origK;
  2154. continue;
  2155. }
  2156. if (is_array($value)) {
  2157. $value = array_map(function ($val) {
  2158. return is_array($val) ? json_encode($val) : $val;
  2159. }, $value);
  2160. $value = '['.implode(', ', $value).']';
  2161. }
  2162. if (is_bool($value)) {
  2163. $value = var_export($value, true);
  2164. }
  2165. if (is_string($rawVal) && $rawVal != $value) {
  2166. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>');
  2167. } else {
  2168. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
  2169. }
  2170. }
  2171. }
  2172. }
  2173. <?php
  2174. namespace Composer\Command;
  2175. use Composer\Config;
  2176. use Composer\Factory;
  2177. use Composer\Installer;
  2178. use Composer\Installer\ProjectInstaller;
  2179. use Composer\Installer\InstallationManager;
  2180. use Composer\Installer\SuggestedPackagesReporter;
  2181. use Composer\IO\IOInterface;
  2182. use Composer\Package\BasePackage;
  2183. use Composer\DependencyResolver\Pool;
  2184. use Composer\DependencyResolver\Operation\InstallOperation;
  2185. use Composer\Package\Version\VersionSelector;
  2186. use Composer\Package\AliasPackage;
  2187. use Composer\Repository\RepositoryFactory;
  2188. use Composer\Repository\CompositeRepository;
  2189. use Composer\Repository\PlatformRepository;
  2190. use Composer\Repository\InstalledFilesystemRepository;
  2191. use Composer\Script\ScriptEvents;
  2192. use Composer\Util\Silencer;
  2193. use Symfony\Component\Console\Input\InputArgument;
  2194. use Symfony\Component\Console\Input\InputInterface;
  2195. use Symfony\Component\Console\Input\InputOption;
  2196. use Symfony\Component\Console\Output\OutputInterface;
  2197. use Symfony\Component\Finder\Finder;
  2198. use Composer\Json\JsonFile;
  2199. use Composer\Config\JsonConfigSource;
  2200. use Composer\Util\Filesystem;
  2201. use Composer\Package\Version\VersionParser;
  2202. class CreateProjectCommand extends BaseCommand
  2203. {
  2204. protected $suggestedPackagesReporter;
  2205. protected function configure()
  2206. {
  2207. $this
  2208. ->setName('create-project')
  2209. ->setDescription('Creates new project from a package into given directory.')
  2210. ->setDefinition(array(
  2211. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2212. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2213. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2214. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2215. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2216. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2217. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2218. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2219. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2220. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2221. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2222. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2223. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2224. 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.'),
  2225. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2226. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2227. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2228. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2229. ))
  2230. ->setHelp(<<<EOT
  2231. The <info>create-project</info> command creates a new project from a given
  2232. package into a new directory. If executed without params and in a directory
  2233. with a composer.json file it installs the packages for the current project.
  2234. You can use this command to bootstrap new projects or setup a clean
  2235. version-controlled installation for developers of your project.
  2236. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2237. You can also specify the version with the package name using = or : as separator.
  2238. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2239. To install unstable packages, either specify the version you want, or use the
  2240. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2241. To setup a developer workable version you should create the project using the source
  2242. controlled code by appending the <info>'--prefer-source'</info> flag.
  2243. To install a package from another repository than the default one you
  2244. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2245. EOT
  2246. )
  2247. ;
  2248. }
  2249. protected function execute(InputInterface $input, OutputInterface $output)
  2250. {
  2251. $config = Factory::createConfig();
  2252. $io = $this->getIO();
  2253. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2254. if ($input->getOption('dev')) {
  2255. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2256. }
  2257. if ($input->getOption('no-custom-installers')) {
  2258. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2259. $input->setOption('no-plugins', true);
  2260. }
  2261. return $this->installProject(
  2262. $io,
  2263. $config,
  2264. $input,
  2265. $input->getArgument('package'),
  2266. $input->getArgument('directory'),
  2267. $input->getArgument('version'),
  2268. $input->getOption('stability'),
  2269. $preferSource,
  2270. $preferDist,
  2271. !$input->getOption('no-dev'),
  2272. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2273. $input->getOption('no-plugins'),
  2274. $input->getOption('no-scripts'),
  2275. $input->getOption('keep-vcs'),
  2276. $input->getOption('no-progress'),
  2277. $input->getOption('no-install'),
  2278. $input->getOption('ignore-platform-reqs'),
  2279. !$input->getOption('no-secure-http'),
  2280. $input->getOption('remove-vcs')
  2281. );
  2282. }
  2283. 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, $keepVcs = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true, $removeVcs = false)
  2284. {
  2285. $oldCwd = getcwd();
  2286. $io->loadConfiguration($config);
  2287. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2288. if ($packageName !== null) {
  2289. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $keepVcs, $noProgress, $ignorePlatformReqs, $secureHttp);
  2290. } else {
  2291. $installedFromVcs = false;
  2292. }
  2293. $composer = Factory::create($io, null, $disablePlugins);
  2294. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2295. $fs = new Filesystem();
  2296. if ($noScripts === false) {
  2297. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2298. }
  2299. $config = $composer->getConfig();
  2300. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2301. if ($noInstall === false) {
  2302. $installer = Installer::create($io, $composer);
  2303. $installer->setPreferSource($preferSource)
  2304. ->setPreferDist($preferDist)
  2305. ->setDevMode($installDevPackages)
  2306. ->setRunScripts(!$noScripts)
  2307. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2308. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2309. ->setOptimizeAutoloader($config->get('optimize-autoloader'));
  2310. if ($disablePlugins) {
  2311. $installer->disablePlugins();
  2312. }
  2313. $status = $installer->run();
  2314. if (0 !== $status) {
  2315. return $status;
  2316. }
  2317. }
  2318. $hasVcs = $installedFromVcs;
  2319. if (
  2320. !$keepVcs
  2321. && $installedFromVcs
  2322. && (
  2323. $removeVcs
  2324. || !$io->isInteractive()
  2325. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2326. )
  2327. ) {
  2328. $finder = new Finder();
  2329. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2330. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2331. $finder->name($vcsName);
  2332. }
  2333. try {
  2334. $dirs = iterator_to_array($finder);
  2335. unset($finder);
  2336. foreach ($dirs as $dir) {
  2337. if (!$fs->removeDirectory($dir)) {
  2338. throw new \RuntimeException('Could not remove '.$dir);
  2339. }
  2340. }
  2341. } catch (\Exception $e) {
  2342. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2343. }
  2344. $hasVcs = false;
  2345. }
  2346. if (!$hasVcs) {
  2347. $package = $composer->getPackage();
  2348. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2349. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2350. foreach ($package->{'get'.$meta['method']}() as $link) {
  2351. if ($link->getPrettyConstraint() === 'self.version') {
  2352. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2353. }
  2354. }
  2355. }
  2356. }
  2357. if ($noScripts === false) {
  2358. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2359. }
  2360. chdir($oldCwd);
  2361. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2362. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2363. Silencer::call('rmdir', $vendorComposerDir);
  2364. $vendorDir = $config->get('vendor-dir');
  2365. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2366. Silencer::call('rmdir', $vendorDir);
  2367. }
  2368. }
  2369. return 0;
  2370. }
  2371. 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, $keepVcs = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2372. {
  2373. if (!$secureHttp) {
  2374. $config->merge(array('config' => array('secure-http' => false)));
  2375. }
  2376. if (null === $repository) {
  2377. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2378. } else {
  2379. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2380. }
  2381. $parser = new VersionParser();
  2382. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2383. $name = strtolower($requirements[0]['name']);
  2384. if (!$packageVersion && isset($requirements[0]['version'])) {
  2385. $packageVersion = $requirements[0]['version'];
  2386. }
  2387. if (null === $stability) {
  2388. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2389. $stability = $match[1];
  2390. } else {
  2391. $stability = VersionParser::parseStability($packageVersion);
  2392. }
  2393. }
  2394. $stability = VersionParser::normalizeStability($stability);
  2395. if (!isset(BasePackage::$stabilities[$stability])) {
  2396. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2397. }
  2398. $pool = new Pool($stability);
  2399. $pool->addRepository($sourceRepo);
  2400. $phpVersion = null;
  2401. $prettyPhpVersion = null;
  2402. if (!$ignorePlatformReqs) {
  2403. $platformOverrides = $config->get('platform') ?: array();
  2404. $platform = new PlatformRepository(array(), $platformOverrides);
  2405. $phpPackage = $platform->findPackage('php', '*');
  2406. $phpVersion = $phpPackage->getVersion();
  2407. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2408. }
  2409. $versionSelector = new VersionSelector($pool);
  2410. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2411. if (!$package) {
  2412. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2413. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2414. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2415. }
  2416. throw new \InvalidArgumentException($errorMessage .'.');
  2417. }
  2418. if (null === $directory) {
  2419. $parts = explode("/", $name, 2);
  2420. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2421. }
  2422. if (function_exists('pcntl_async_signals')) {
  2423. @mkdir($directory, 0777, true);
  2424. if ($realDir = realpath($directory)) {
  2425. pcntl_async_signals(true);
  2426. pcntl_signal(SIGINT, function () use ($realDir) {
  2427. $fs = new Filesystem();
  2428. $fs->removeDirectory($realDir);
  2429. exit(130);
  2430. });
  2431. }
  2432. }
  2433. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2434. if ($disablePlugins) {
  2435. $io->writeError('<info>Plugins have been disabled.</info>');
  2436. }
  2437. if ($package instanceof AliasPackage) {
  2438. $package = $package->getAliasOf();
  2439. }
  2440. if (0 === strpos($package->getPrettyVersion(), 'dev-') && in_array($package->getSourceType(), array('git', 'hg'))) {
  2441. $package->setSourceReference(substr($package->getPrettyVersion(), 4));
  2442. }
  2443. $dm = $this->createDownloadManager($io, $config);
  2444. $dm->setPreferSource($preferSource)
  2445. ->setPreferDist($preferDist)
  2446. ->setOutputProgress(!$noProgress);
  2447. $projectInstaller = new ProjectInstaller($directory, $dm);
  2448. $im = $this->createInstallationManager();
  2449. $im->addInstaller($projectInstaller);
  2450. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2451. $im->notifyInstalls($io);
  2452. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2453. $installedFromVcs = 'source' === $package->getInstallationSource();
  2454. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2455. chdir($directory);
  2456. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2457. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2458. return $installedFromVcs;
  2459. }
  2460. protected function createDownloadManager(IOInterface $io, Config $config)
  2461. {
  2462. $factory = new Factory();
  2463. return $factory->createDownloadManager($io, $config);
  2464. }
  2465. protected function createInstallationManager()
  2466. {
  2467. return new InstallationManager();
  2468. }
  2469. }
  2470. <?php
  2471. namespace Composer\Command;
  2472. use Symfony\Component\Console\Input\InputInterface;
  2473. use Symfony\Component\Console\Output\OutputInterface;
  2474. class DependsCommand extends BaseDependencyCommand
  2475. {
  2476. protected function configure()
  2477. {
  2478. parent::configure();
  2479. $this
  2480. ->setName('depends')
  2481. ->setAliases(array('why'))
  2482. ->setDescription('Shows which packages cause the given package to be installed.')
  2483. ->setHelp(<<<EOT
  2484. Displays detailed information about where a package is referenced.
  2485. <info>php composer.phar depends composer/composer</info>
  2486. EOT
  2487. )
  2488. ;
  2489. }
  2490. protected function execute(InputInterface $input, OutputInterface $output)
  2491. {
  2492. return parent::doExecute($input, $output, false);
  2493. }
  2494. }
  2495. <?php
  2496. namespace Composer\Command;
  2497. use Composer\Composer;
  2498. use Composer\Factory;
  2499. use Composer\Config;
  2500. use Composer\Downloader\TransportException;
  2501. use Composer\Plugin\CommandEvent;
  2502. use Composer\Plugin\PluginEvents;
  2503. use Composer\Util\ConfigValidator;
  2504. use Composer\Util\IniHelper;
  2505. use Composer\Util\ProcessExecutor;
  2506. use Composer\Util\RemoteFilesystem;
  2507. use Composer\Util\StreamContextFactory;
  2508. use Composer\SelfUpdate\Keys;
  2509. use Composer\SelfUpdate\Versions;
  2510. use Composer\IO\NullIO;
  2511. use Symfony\Component\Console\Input\InputInterface;
  2512. use Symfony\Component\Console\Output\OutputInterface;
  2513. class DiagnoseCommand extends BaseCommand
  2514. {
  2515. protected $rfs;
  2516. protected $process;
  2517. protected $exitCode = 0;
  2518. protected function configure()
  2519. {
  2520. $this
  2521. ->setName('diagnose')
  2522. ->setDescription('Diagnoses the system to identify common errors.')
  2523. ->setHelp(<<<EOT
  2524. The <info>diagnose</info> command checks common errors to help debugging problems.
  2525. The process exit code will be 1 in case of warnings and 2 for errors.
  2526. EOT
  2527. )
  2528. ;
  2529. }
  2530. protected function execute(InputInterface $input, OutputInterface $output)
  2531. {
  2532. $composer = $this->getComposer(false);
  2533. $io = $this->getIO();
  2534. if ($composer) {
  2535. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2536. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2537. $io->write('Checking composer.json: ', false);
  2538. $this->outputResult($this->checkComposerSchema());
  2539. }
  2540. if ($composer) {
  2541. $config = $composer->getConfig();
  2542. } else {
  2543. $config = Factory::createConfig();
  2544. }
  2545. $config->merge(array('config' => array('secure-http' => false)));
  2546. $config->prohibitUrlByConfig('http://packagist.org', new NullIO);
  2547. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2548. $this->process = new ProcessExecutor($io);
  2549. $io->write('Checking platform settings: ', false);
  2550. $this->outputResult($this->checkPlatform());
  2551. $io->write('Checking git settings: ', false);
  2552. $this->outputResult($this->checkGit());
  2553. $io->write('Checking http connectivity to packagist: ', false);
  2554. $this->outputResult($this->checkHttp('http', $config));
  2555. $io->write('Checking https connectivity to packagist: ', false);
  2556. $this->outputResult($this->checkHttp('https', $config));
  2557. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2558. if (!empty($opts['http']['proxy'])) {
  2559. $io->write('Checking HTTP proxy: ', false);
  2560. $this->outputResult($this->checkHttpProxy());
  2561. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2562. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2563. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2564. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2565. }
  2566. if ($oauth = $config->get('github-oauth')) {
  2567. foreach ($oauth as $domain => $token) {
  2568. $io->write('Checking '.$domain.' oauth access: ', false);
  2569. $this->outputResult($this->checkGithubOauth($domain, $token));
  2570. }
  2571. } else {
  2572. $io->write('Checking github.com rate limit: ', false);
  2573. try {
  2574. $rate = $this->getGithubRateLimit('github.com');
  2575. $this->outputResult(true);
  2576. if (10 > $rate['remaining']) {
  2577. $io->write('<warning>WARNING</warning>');
  2578. $io->write(sprintf(
  2579. '<comment>Github has a rate limit on their API. '
  2580. . 'You currently have <options=bold>%u</options=bold> '
  2581. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2582. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2583. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2584. $rate['remaining'],
  2585. $rate['limit']
  2586. ));
  2587. }
  2588. } catch (\Exception $e) {
  2589. if ($e instanceof TransportException && $e->getCode() === 401) {
  2590. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2591. } else {
  2592. $this->outputResult($e);
  2593. }
  2594. }
  2595. }
  2596. $io->write('Checking disk free space: ', false);
  2597. $this->outputResult($this->checkDiskSpace($config));
  2598. if ('phar:' === substr(__FILE__, 0, 5)) {
  2599. $io->write('Checking pubkeys: ', false);
  2600. $this->outputResult($this->checkPubKeys($config));
  2601. $io->write('Checking composer version: ', false);
  2602. $this->outputResult($this->checkVersion($config));
  2603. }
  2604. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2605. $io->write(sprintf('PHP version: <comment>%s</comment>', PHP_VERSION));
  2606. if (defined('PHP_BINARY')) {
  2607. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2608. }
  2609. return $this->exitCode;
  2610. }
  2611. private function checkComposerSchema()
  2612. {
  2613. $validator = new ConfigValidator($this->getIO());
  2614. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2615. if ($errors || $warnings) {
  2616. $messages = array(
  2617. 'error' => $errors,
  2618. 'warning' => $warnings,
  2619. );
  2620. $output = '';
  2621. foreach ($messages as $style => $msgs) {
  2622. foreach ($msgs as $msg) {
  2623. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2624. }
  2625. }
  2626. return rtrim($output);
  2627. }
  2628. return true;
  2629. }
  2630. private function checkGit()
  2631. {
  2632. $this->process->execute('git config color.ui', $output);
  2633. if (strtolower(trim($output)) === 'always') {
  2634. 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>';
  2635. }
  2636. return true;
  2637. }
  2638. private function checkHttp($proto, Config $config)
  2639. {
  2640. $disableTls = false;
  2641. $result = array();
  2642. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2643. $disableTls = true;
  2644. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2645. }
  2646. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2647. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2648. }
  2649. try {
  2650. $this->rfs->getContents('packagist.org', $proto . '://packagist.org/packages.json', false);
  2651. } catch (TransportException $e) {
  2652. if (false !== strpos($e->getMessage(), 'cafile')) {
  2653. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2654. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2655. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2656. } else {
  2657. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2658. }
  2659. }
  2660. if (count($result) > 0) {
  2661. return $result;
  2662. }
  2663. return true;
  2664. }
  2665. private function checkHttpProxy()
  2666. {
  2667. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2668. try {
  2669. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://packagist.org/packages.json', false), true);
  2670. $hash = reset($json['provider-includes']);
  2671. $hash = $hash['sha256'];
  2672. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2673. $provider = $this->rfs->getContents('packagist.org', $protocol . '://packagist.org/'.$path, false);
  2674. if (hash('sha256', $provider) !== $hash) {
  2675. return 'It seems that your proxy is modifying http traffic on the fly';
  2676. }
  2677. } catch (\Exception $e) {
  2678. return $e;
  2679. }
  2680. return true;
  2681. }
  2682. private function checkHttpProxyFullUriRequestParam()
  2683. {
  2684. $url = 'http://packagist.org/packages.json';
  2685. try {
  2686. $this->rfs->getContents('packagist.org', $url, false);
  2687. } catch (TransportException $e) {
  2688. try {
  2689. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2690. } catch (TransportException $e) {
  2691. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2692. }
  2693. 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"';
  2694. }
  2695. return true;
  2696. }
  2697. private function checkHttpsProxyFullUriRequestParam()
  2698. {
  2699. if (!extension_loaded('openssl')) {
  2700. return 'You need the openssl extension installed for this check';
  2701. }
  2702. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2703. try {
  2704. $this->rfs->getContents('github.com', $url, false);
  2705. } catch (TransportException $e) {
  2706. try {
  2707. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2708. } catch (TransportException $e) {
  2709. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2710. }
  2711. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2712. }
  2713. return true;
  2714. }
  2715. private function checkGithubOauth($domain, $token)
  2716. {
  2717. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2718. try {
  2719. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2720. return $this->rfs->getContents($domain, $url, false, array(
  2721. 'retry-auth-failure' => false,
  2722. )) ? true : 'Unexpected error';
  2723. } catch (\Exception $e) {
  2724. if ($e instanceof TransportException && $e->getCode() === 401) {
  2725. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2726. }
  2727. return $e;
  2728. }
  2729. }
  2730. private function getGithubRateLimit($domain, $token = null)
  2731. {
  2732. if ($token) {
  2733. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2734. }
  2735. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2736. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2737. $data = json_decode($json, true);
  2738. return $data['resources']['core'];
  2739. }
  2740. private function checkDiskSpace($config)
  2741. {
  2742. $minSpaceFree = 1024 * 1024;
  2743. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2744. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2745. ) {
  2746. return '<error>The disk hosting '.$dir.' is full</error>';
  2747. }
  2748. return true;
  2749. }
  2750. private function checkPubKeys($config)
  2751. {
  2752. $home = $config->get('home');
  2753. $errors = array();
  2754. $io = $this->getIO();
  2755. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2756. $io->write('');
  2757. }
  2758. if (file_exists($home.'/keys.tags.pub')) {
  2759. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2760. } else {
  2761. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2762. }
  2763. if (file_exists($home.'/keys.dev.pub')) {
  2764. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2765. } else {
  2766. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2767. }
  2768. if ($errors) {
  2769. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2770. }
  2771. return $errors ?: true;
  2772. }
  2773. private function checkVersion($config)
  2774. {
  2775. $versionsUtil = new Versions($config, $this->rfs);
  2776. $latest = $versionsUtil->getLatest();
  2777. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2778. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2779. }
  2780. return true;
  2781. }
  2782. private function outputResult($result)
  2783. {
  2784. $io = $this->getIO();
  2785. if (true === $result) {
  2786. $io->write('<info>OK</info>');
  2787. return;
  2788. }
  2789. $hadError = false;
  2790. if ($result instanceof \Exception) {
  2791. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2792. }
  2793. if (!$result) {
  2794. $hadError = true;
  2795. } else {
  2796. if (!is_array($result)) {
  2797. $result = array($result);
  2798. }
  2799. foreach ($result as $message) {
  2800. if (false !== strpos($message, '<error>')) {
  2801. $hadError = true;
  2802. }
  2803. }
  2804. }
  2805. if ($hadError) {
  2806. $io->write('<error>FAIL</error>');
  2807. $this->exitCode = 2;
  2808. } else {
  2809. $io->write('<warning>WARNING</warning>');
  2810. $this->exitCode = 1;
  2811. }
  2812. if ($result) {
  2813. foreach ($result as $message) {
  2814. $io->write($message);
  2815. }
  2816. }
  2817. }
  2818. private function checkPlatform()
  2819. {
  2820. $output = '';
  2821. $out = function ($msg, $style) use (&$output) {
  2822. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2823. };
  2824. $errors = array();
  2825. $warnings = array();
  2826. $displayIniMessage = false;
  2827. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  2828. $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.';
  2829. if (!function_exists('json_decode')) {
  2830. $errors['json'] = true;
  2831. }
  2832. if (!extension_loaded('Phar')) {
  2833. $errors['phar'] = true;
  2834. }
  2835. if (!extension_loaded('filter')) {
  2836. $errors['filter'] = true;
  2837. }
  2838. if (!extension_loaded('hash')) {
  2839. $errors['hash'] = true;
  2840. }
  2841. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2842. $errors['iconv_mbstring'] = true;
  2843. }
  2844. if (!ini_get('allow_url_fopen')) {
  2845. $errors['allow_url_fopen'] = true;
  2846. }
  2847. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2848. $errors['ioncube'] = ioncube_loader_version();
  2849. }
  2850. if (PHP_VERSION_ID < 50302) {
  2851. $errors['php'] = PHP_VERSION;
  2852. }
  2853. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2854. $warnings['php'] = PHP_VERSION;
  2855. }
  2856. if (!extension_loaded('openssl')) {
  2857. $errors['openssl'] = true;
  2858. }
  2859. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2860. $warnings['openssl_version'] = true;
  2861. }
  2862. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
  2863. $warnings['apc_cli'] = true;
  2864. }
  2865. if (!extension_loaded('zlib')) {
  2866. $warnings['zlib'] = true;
  2867. }
  2868. ob_start();
  2869. phpinfo(INFO_GENERAL);
  2870. $phpinfo = ob_get_clean();
  2871. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  2872. $configure = $match[1];
  2873. if (false !== strpos($configure, '--enable-sigchild')) {
  2874. $warnings['sigchild'] = true;
  2875. }
  2876. if (false !== strpos($configure, '--with-curlwrappers')) {
  2877. $warnings['curlwrappers'] = true;
  2878. }
  2879. }
  2880. if (ini_get('xdebug.profiler_enabled')) {
  2881. $warnings['xdebug_profile'] = true;
  2882. } elseif (extension_loaded('xdebug')) {
  2883. $warnings['xdebug_loaded'] = true;
  2884. }
  2885. if (!empty($errors)) {
  2886. foreach ($errors as $error => $current) {
  2887. switch ($error) {
  2888. case 'json':
  2889. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  2890. $text .= "Install it or recompile php without --disable-json";
  2891. break;
  2892. case 'phar':
  2893. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  2894. $text .= "Install it or recompile php without --disable-phar";
  2895. break;
  2896. case 'filter':
  2897. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  2898. $text .= "Install it or recompile php without --disable-filter";
  2899. break;
  2900. case 'hash':
  2901. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  2902. $text .= "Install it or recompile php without --disable-hash";
  2903. break;
  2904. case 'iconv_mbstring':
  2905. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  2906. $text .= "Install either of them or recompile php without --disable-iconv";
  2907. break;
  2908. case 'unicode':
  2909. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  2910. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2911. $text .= " detect_unicode = Off";
  2912. $displayIniMessage = true;
  2913. break;
  2914. case 'suhosin':
  2915. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  2916. $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;
  2917. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  2918. $displayIniMessage = true;
  2919. break;
  2920. case 'php':
  2921. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  2922. break;
  2923. case 'allow_url_fopen':
  2924. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  2925. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2926. $text .= " allow_url_fopen = On";
  2927. $displayIniMessage = true;
  2928. break;
  2929. case 'ioncube':
  2930. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  2931. $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;
  2932. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  2933. $displayIniMessage = true;
  2934. break;
  2935. case 'openssl':
  2936. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  2937. $text .= "If possible you should enable it or recompile php with --with-openssl";
  2938. break;
  2939. }
  2940. $out($text, 'error');
  2941. }
  2942. $output .= PHP_EOL;
  2943. }
  2944. if (!empty($warnings)) {
  2945. foreach ($warnings as $warning => $current) {
  2946. switch ($warning) {
  2947. case 'apc_cli':
  2948. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  2949. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2950. $text .= " apc.enable_cli = Off";
  2951. $displayIniMessage = true;
  2952. break;
  2953. case 'zlib':
  2954. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  2955. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  2956. $displayIniMessage = true;
  2957. break;
  2958. case 'sigchild':
  2959. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  2960. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  2961. $text .= " https://bugs.php.net/bug.php?id=22999";
  2962. break;
  2963. case 'curlwrappers':
  2964. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  2965. $text .= " Recompile it without this flag if possible";
  2966. break;
  2967. case 'php':
  2968. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  2969. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  2970. break;
  2971. case 'openssl_version':
  2972. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  2973. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  2974. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  2975. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  2976. break;
  2977. case 'xdebug_loaded':
  2978. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  2979. $text .= " Disabling it when using Composer is recommended.";
  2980. break;
  2981. case 'xdebug_profile':
  2982. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  2983. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  2984. $text .= " xdebug.profiler_enabled = 0";
  2985. $displayIniMessage = true;
  2986. break;
  2987. }
  2988. $out($text, 'comment');
  2989. }
  2990. }
  2991. if ($displayIniMessage) {
  2992. $out($iniMessage, 'comment');
  2993. }
  2994. return !$warnings && !$errors ? true : $output;
  2995. }
  2996. }
  2997. <?php
  2998. namespace Composer\Command;
  2999. use Composer\Plugin\CommandEvent;
  3000. use Composer\Plugin\PluginEvents;
  3001. use Symfony\Component\Console\Input\InputInterface;
  3002. use Symfony\Component\Console\Input\InputOption;
  3003. use Symfony\Component\Console\Output\OutputInterface;
  3004. class DumpAutoloadCommand extends BaseCommand
  3005. {
  3006. protected function configure()
  3007. {
  3008. $this
  3009. ->setName('dump-autoload')
  3010. ->setAliases(array('dumpautoload'))
  3011. ->setDescription('Dumps the autoloader.')
  3012. ->setDefinition(array(
  3013. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3014. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3015. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3016. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3017. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3018. ))
  3019. ->setHelp(<<<EOT
  3020. <info>php composer.phar dump-autoload</info>
  3021. EOT
  3022. )
  3023. ;
  3024. }
  3025. protected function execute(InputInterface $input, OutputInterface $output)
  3026. {
  3027. $composer = $this->getComposer();
  3028. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3029. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3030. $installationManager = $composer->getInstallationManager();
  3031. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3032. $package = $composer->getPackage();
  3033. $config = $composer->getConfig();
  3034. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3035. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3036. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3037. if ($authoritative) {
  3038. $this->getIO()->writeError('<info>Generating optimized autoload files (authoritative)</info>');
  3039. } elseif ($optimize) {
  3040. $this->getIO()->writeError('<info>Generating optimized autoload files</info>');
  3041. } else {
  3042. $this->getIO()->writeError('<info>Generating autoload files</info>');
  3043. }
  3044. $generator = $composer->getAutoloadGenerator();
  3045. $generator->setDevMode(!$input->getOption('no-dev'));
  3046. $generator->setClassMapAuthoritative($authoritative);
  3047. $generator->setApcu($apcu);
  3048. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3049. $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3050. }
  3051. }
  3052. <?php
  3053. namespace Composer\Command;
  3054. use Symfony\Component\Console\Input\InputInterface;
  3055. use Symfony\Component\Console\Input\InputOption;
  3056. use Symfony\Component\Console\Output\OutputInterface;
  3057. use Symfony\Component\Console\Input\InputArgument;
  3058. class ExecCommand extends BaseCommand
  3059. {
  3060. protected function configure()
  3061. {
  3062. $this
  3063. ->setName('exec')
  3064. ->setDescription('Executes a vendored binary/script.')
  3065. ->setDefinition(array(
  3066. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3067. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3068. new InputArgument(
  3069. 'args',
  3070. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3071. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3072. ),
  3073. ))
  3074. ;
  3075. }
  3076. protected function execute(InputInterface $input, OutputInterface $output)
  3077. {
  3078. $composer = $this->getComposer();
  3079. $binDir = $composer->getConfig()->get('bin-dir');
  3080. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3081. $bins = glob($binDir . '/*');
  3082. $bins = array_merge($bins, array_map(function ($e) {
  3083. return "$e (local)";
  3084. }, $composer->getPackage()->getBinaries()));
  3085. if (!$bins) {
  3086. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3087. }
  3088. $this->getIO()->write(<<<EOT
  3089. <comment>Available binaries:</comment>
  3090. EOT
  3091. );
  3092. foreach ($bins as $bin) {
  3093. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3094. continue;
  3095. }
  3096. $previousBin = $bin;
  3097. $bin = basename($bin);
  3098. $this->getIO()->write(<<<EOT
  3099. <info>- $bin</info>
  3100. EOT
  3101. );
  3102. }
  3103. return 0;
  3104. }
  3105. $binary = $input->getArgument('binary');
  3106. $dispatcher = $composer->getEventDispatcher();
  3107. $dispatcher->addListener('__exec_command', $binary);
  3108. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3109. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3110. }
  3111. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3112. }
  3113. }
  3114. <?php
  3115. namespace Composer\Command;
  3116. use Composer\Factory;
  3117. use Symfony\Component\Console\Input\InputInterface;
  3118. use Symfony\Component\Console\Input\InputArgument;
  3119. use Symfony\Component\Console\Input\StringInput;
  3120. use Symfony\Component\Console\Output\OutputInterface;
  3121. class GlobalCommand extends BaseCommand
  3122. {
  3123. protected function configure()
  3124. {
  3125. $this
  3126. ->setName('global')
  3127. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3128. ->setDefinition(array(
  3129. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3130. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3131. ))
  3132. ->setHelp(<<<EOT
  3133. Use this command as a wrapper to run other Composer commands
  3134. within the global context of COMPOSER_HOME.
  3135. You can use this to install CLI utilities globally, all you need
  3136. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3137. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3138. and /home/<user>/.composer on unix systems.
  3139. If your system uses freedesktop.org standards, then it will first check
  3140. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3141. Note: This path may vary depending on customizations to bin-dir in
  3142. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3143. EOT
  3144. )
  3145. ;
  3146. }
  3147. public function run(InputInterface $input, OutputInterface $output)
  3148. {
  3149. $tokens = preg_split('{\s+}', $input->__toString());
  3150. $args = array();
  3151. foreach ($tokens as $token) {
  3152. if ($token && $token[0] !== '-') {
  3153. $args[] = $token;
  3154. if (count($args) >= 2) {
  3155. break;
  3156. }
  3157. }
  3158. }
  3159. if (count($args) < 2) {
  3160. return parent::run($input, $output);
  3161. }
  3162. $config = Factory::createConfig();
  3163. chdir($config->get('home'));
  3164. $this->getIO()->writeError('<info>Changed current directory to '.$config->get('home').'</info>');
  3165. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3166. $this->getApplication()->resetComposer();
  3167. return $this->getApplication()->run($input, $output);
  3168. }
  3169. public function isProxyCommand()
  3170. {
  3171. return true;
  3172. }
  3173. }
  3174. <?php
  3175. namespace Composer\Command;
  3176. use Composer\Package\CompletePackageInterface;
  3177. use Composer\Repository\RepositoryInterface;
  3178. use Composer\Repository\ArrayRepository;
  3179. use Composer\Repository\RepositoryFactory;
  3180. use Composer\Util\Platform;
  3181. use Composer\Util\ProcessExecutor;
  3182. use Symfony\Component\Console\Input\InputArgument;
  3183. use Symfony\Component\Console\Input\InputOption;
  3184. use Symfony\Component\Console\Input\InputInterface;
  3185. use Symfony\Component\Console\Output\OutputInterface;
  3186. class HomeCommand extends BaseCommand
  3187. {
  3188. protected function configure()
  3189. {
  3190. $this
  3191. ->setName('browse')
  3192. ->setAliases(array('home'))
  3193. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3194. ->setDefinition(array(
  3195. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3196. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3197. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3198. ))
  3199. ->setHelp(<<<EOT
  3200. The home command opens or shows a package's repository URL or
  3201. homepage in your default browser.
  3202. To open the homepage by default, use -H or --homepage.
  3203. To show instead of open the repository or homepage URL, use -s or --show.
  3204. EOT
  3205. );
  3206. }
  3207. protected function execute(InputInterface $input, OutputInterface $output)
  3208. {
  3209. $repos = $this->initializeRepos();
  3210. $io = $this->getIO();
  3211. $return = 0;
  3212. $packages = $input->getArgument('packages');
  3213. if (!$packages) {
  3214. $io->writeError('No package specified, opening homepage for the root package');
  3215. $packages = array($this->getComposer()->getPackage()->getName());
  3216. }
  3217. foreach ($packages as $packageName) {
  3218. $handled = false;
  3219. $packageExists = false;
  3220. foreach ($repos as $repo) {
  3221. foreach ($repo->findPackages($packageName) as $package) {
  3222. $packageExists = true;
  3223. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3224. $handled = true;
  3225. break 2;
  3226. }
  3227. }
  3228. }
  3229. if (!$packageExists) {
  3230. $return = 1;
  3231. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3232. }
  3233. if (!$handled) {
  3234. $return = 1;
  3235. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3236. }
  3237. }
  3238. return $return;
  3239. }
  3240. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3241. {
  3242. $support = $package->getSupport();
  3243. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3244. if (!$url || $showHomepage) {
  3245. $url = $package->getHomepage();
  3246. }
  3247. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3248. return false;
  3249. }
  3250. if ($showOnly) {
  3251. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3252. } else {
  3253. $this->openBrowser($url);
  3254. }
  3255. return true;
  3256. }
  3257. private function openBrowser($url)
  3258. {
  3259. $url = ProcessExecutor::escape($url);
  3260. $process = new ProcessExecutor($this->getIO());
  3261. if (Platform::isWindows()) {
  3262. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3263. }
  3264. $linux = $process->execute('which xdg-open', $output);
  3265. $osx = $process->execute('which open', $output);
  3266. if (0 === $linux) {
  3267. $process->execute('xdg-open ' . $url, $output);
  3268. } elseif (0 === $osx) {
  3269. $process->execute('open ' . $url, $output);
  3270. } else {
  3271. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3272. }
  3273. }
  3274. private function initializeRepos()
  3275. {
  3276. $composer = $this->getComposer(false);
  3277. if ($composer) {
  3278. return array_merge(
  3279. array(new ArrayRepository(array($composer->getPackage()))),
  3280. array($composer->getRepositoryManager()->getLocalRepository()),
  3281. $composer->getRepositoryManager()->getRepositories()
  3282. );
  3283. }
  3284. return RepositoryFactory::defaultRepos($this->getIO());
  3285. }
  3286. }
  3287. <?php
  3288. namespace Composer\Command;
  3289. use Composer\DependencyResolver\Pool;
  3290. use Composer\Factory;
  3291. use Composer\Json\JsonFile;
  3292. use Composer\Package\BasePackage;
  3293. use Composer\Package\Version\VersionParser;
  3294. use Composer\Package\Version\VersionSelector;
  3295. use Composer\Repository\CompositeRepository;
  3296. use Composer\Repository\PlatformRepository;
  3297. use Composer\Repository\RepositoryFactory;
  3298. use Composer\Util\ProcessExecutor;
  3299. use Symfony\Component\Console\Input\InputInterface;
  3300. use Symfony\Component\Console\Input\InputOption;
  3301. use Symfony\Component\Console\Output\OutputInterface;
  3302. use Symfony\Component\Process\ExecutableFinder;
  3303. use Symfony\Component\Process\Process;
  3304. class InitCommand extends BaseCommand
  3305. {
  3306. protected $repos;
  3307. private $gitConfig;
  3308. private $pools;
  3309. protected function configure()
  3310. {
  3311. $this
  3312. ->setName('init')
  3313. ->setDescription('Creates a basic composer.json file in current directory.')
  3314. ->setDefinition(array(
  3315. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3316. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3317. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3318. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3319. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3320. 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"'),
  3321. 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"'),
  3322. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3323. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3324. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3325. ))
  3326. ->setHelp(<<<EOT
  3327. The <info>init</info> command creates a basic composer.json file
  3328. in the current directory.
  3329. <info>php composer.phar init</info>
  3330. EOT
  3331. )
  3332. ;
  3333. }
  3334. protected function execute(InputInterface $input, OutputInterface $output)
  3335. {
  3336. $io = $this->getIO();
  3337. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3338. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3339. if (isset($options['author'])) {
  3340. $options['authors'] = $this->formatAuthors($options['author']);
  3341. unset($options['author']);
  3342. }
  3343. $repositories = $input->getOption('repository');
  3344. if ($repositories) {
  3345. $config = Factory::createConfig($io);
  3346. foreach ($repositories as $repo) {
  3347. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3348. }
  3349. }
  3350. if (isset($options['stability'])) {
  3351. $options['minimum-stability'] = $options['stability'];
  3352. unset($options['stability']);
  3353. }
  3354. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3355. if (array() === $options['require']) {
  3356. $options['require'] = new \stdClass;
  3357. }
  3358. if (isset($options['require-dev'])) {
  3359. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3360. if (array() === $options['require-dev']) {
  3361. $options['require-dev'] = new \stdClass;
  3362. }
  3363. }
  3364. $file = new JsonFile(Factory::getComposerFile());
  3365. $json = $file->encode($options);
  3366. if ($input->isInteractive()) {
  3367. $io->writeError(array('', $json, ''));
  3368. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3369. $io->writeError('<error>Command aborted</error>');
  3370. return 1;
  3371. }
  3372. }
  3373. $file->write($options);
  3374. if ($input->isInteractive() && is_dir('.git')) {
  3375. $ignoreFile = realpath('.gitignore');
  3376. if (false === $ignoreFile) {
  3377. $ignoreFile = realpath('.') . '/.gitignore';
  3378. }
  3379. if (!$this->hasVendorIgnore($ignoreFile)) {
  3380. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3381. if ($io->askConfirmation($question, true)) {
  3382. $this->addVendorIgnore($ignoreFile);
  3383. }
  3384. }
  3385. }
  3386. }
  3387. protected function interact(InputInterface $input, OutputInterface $output)
  3388. {
  3389. $git = $this->getGitConfig();
  3390. $io = $this->getIO();
  3391. $formatter = $this->getHelperSet()->get('formatter');
  3392. $repositories = $input->getOption('repository');
  3393. if ($repositories) {
  3394. $config = Factory::createConfig($io);
  3395. $repos = array(new PlatformRepository);
  3396. foreach ($repositories as $repo) {
  3397. $repos[] = RepositoryFactory::fromString($io, $config, $repo);
  3398. }
  3399. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3400. 'type' => 'composer',
  3401. 'url' => 'https://packagist.org',
  3402. ));
  3403. $this->repos = new CompositeRepository($repos);
  3404. unset($repos, $config, $repositories);
  3405. }
  3406. $io->writeError(array(
  3407. '',
  3408. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3409. '',
  3410. ));
  3411. $io->writeError(array(
  3412. '',
  3413. 'This command will guide you through creating your composer.json config.',
  3414. '',
  3415. ));
  3416. $cwd = realpath(".");
  3417. if (!$name = $input->getOption('name')) {
  3418. $name = basename($cwd);
  3419. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3420. $name = strtolower($name);
  3421. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3422. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3423. } elseif (isset($git['github.user'])) {
  3424. $name = $git['github.user'] . '/' . $name;
  3425. } elseif (!empty($_SERVER['USERNAME'])) {
  3426. $name = $_SERVER['USERNAME'] . '/' . $name;
  3427. } elseif (!empty($_SERVER['USER'])) {
  3428. $name = $_SERVER['USER'] . '/' . $name;
  3429. } elseif (get_current_user()) {
  3430. $name = get_current_user() . '/' . $name;
  3431. } else {
  3432. $name = $name . '/' . $name;
  3433. }
  3434. $name = strtolower($name);
  3435. } else {
  3436. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) {
  3437. throw new \InvalidArgumentException(
  3438. '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_.-]+'
  3439. );
  3440. }
  3441. }
  3442. $name = $io->askAndValidate(
  3443. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3444. function ($value) use ($name) {
  3445. if (null === $value) {
  3446. return $name;
  3447. }
  3448. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $value)) {
  3449. throw new \InvalidArgumentException(
  3450. '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_.-]+'
  3451. );
  3452. }
  3453. return $value;
  3454. },
  3455. null,
  3456. $name
  3457. );
  3458. $input->setOption('name', $name);
  3459. $description = $input->getOption('description') ?: false;
  3460. $description = $io->ask(
  3461. 'Description [<comment>'.$description.'</comment>]: ',
  3462. $description
  3463. );
  3464. $input->setOption('description', $description);
  3465. if (null === $author = $input->getOption('author')) {
  3466. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3467. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3468. } elseif (isset($git['user.name'])) {
  3469. $author_name = $git['user.name'];
  3470. }
  3471. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3472. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3473. } elseif (isset($git['user.email'])) {
  3474. $author_email = $git['user.email'];
  3475. }
  3476. if (isset($author_name) && isset($author_email)) {
  3477. $author = sprintf('%s <%s>', $author_name, $author_email);
  3478. }
  3479. }
  3480. $self = $this;
  3481. $author = $io->askAndValidate(
  3482. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3483. function ($value) use ($self, $author) {
  3484. if ($value === 'n' || $value === 'no') {
  3485. return;
  3486. }
  3487. $value = $value ?: $author;
  3488. $author = $self->parseAuthorString($value);
  3489. return sprintf('%s <%s>', $author['name'], $author['email']);
  3490. },
  3491. null,
  3492. $author
  3493. );
  3494. $input->setOption('author', $author);
  3495. $minimumStability = $input->getOption('stability') ?: null;
  3496. $minimumStability = $io->askAndValidate(
  3497. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3498. function ($value) use ($minimumStability) {
  3499. if (null === $value) {
  3500. return $minimumStability;
  3501. }
  3502. if (!isset(BasePackage::$stabilities[$value])) {
  3503. throw new \InvalidArgumentException(
  3504. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3505. implode(', ', array_keys(BasePackage::$stabilities))
  3506. );
  3507. }
  3508. return $value;
  3509. },
  3510. null,
  3511. $minimumStability
  3512. );
  3513. $input->setOption('stability', $minimumStability);
  3514. $type = $input->getOption('type') ?: false;
  3515. $type = $io->ask(
  3516. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3517. $type
  3518. );
  3519. $input->setOption('type', $type);
  3520. if (null === $license = $input->getOption('license')) {
  3521. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3522. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3523. }
  3524. }
  3525. $license = $io->ask(
  3526. 'License [<comment>'.$license.'</comment>]: ',
  3527. $license
  3528. );
  3529. $input->setOption('license', $license);
  3530. $io->writeError(array('', 'Define your dependencies.', ''));
  3531. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3532. $require = $input->getOption('require');
  3533. $requirements = array();
  3534. if ($require || $io->askConfirmation($question, true)) {
  3535. $requirements = $this->determineRequirements($input, $output, $require);
  3536. }
  3537. $input->setOption('require', $requirements);
  3538. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3539. $requireDev = $input->getOption('require-dev');
  3540. $devRequirements = array();
  3541. if ($requireDev || $io->askConfirmation($question, true)) {
  3542. $devRequirements = $this->determineRequirements($input, $output, $requireDev);
  3543. }
  3544. $input->setOption('require-dev', $devRequirements);
  3545. }
  3546. public function parseAuthorString($author)
  3547. {
  3548. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3549. if ($this->isValidEmail($match['email'])) {
  3550. return array(
  3551. 'name' => trim($match['name']),
  3552. 'email' => $match['email'],
  3553. );
  3554. }
  3555. }
  3556. throw new \InvalidArgumentException(
  3557. 'Invalid author string. Must be in the format: '.
  3558. 'John Smith <john@example.com>'
  3559. );
  3560. }
  3561. protected function findPackages($name)
  3562. {
  3563. return $this->getRepos()->search($name);
  3564. }
  3565. protected function getRepos()
  3566. {
  3567. if (!$this->repos) {
  3568. $this->repos = new CompositeRepository(array_merge(
  3569. array(new PlatformRepository),
  3570. RepositoryFactory::defaultRepos($this->getIO())
  3571. ));
  3572. }
  3573. return $this->repos;
  3574. }
  3575. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable')
  3576. {
  3577. if ($requires) {
  3578. $requires = $this->normalizeRequirements($requires);
  3579. $result = array();
  3580. $io = $this->getIO();
  3581. foreach ($requires as $requirement) {
  3582. if (!isset($requirement['version'])) {
  3583. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability);
  3584. $requirement['version'] = $version;
  3585. $requirement['name'] = $name;
  3586. $io->writeError(sprintf(
  3587. 'Using version <info>%s</info> for <info>%s</info>',
  3588. $requirement['version'],
  3589. $requirement['name']
  3590. ));
  3591. } else {
  3592. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $requirement['version'], 'dev');
  3593. $requirement['name'] = $name;
  3594. }
  3595. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3596. }
  3597. return $result;
  3598. }
  3599. $versionParser = new VersionParser();
  3600. $io = $this->getIO();
  3601. while (null !== $package = $io->ask('Search for a package: ')) {
  3602. $matches = $this->findPackages($package);
  3603. if (count($matches)) {
  3604. $exactMatch = null;
  3605. $choices = array();
  3606. foreach ($matches as $position => $foundPackage) {
  3607. $abandoned = '';
  3608. if (isset($foundPackage['abandoned'])) {
  3609. if (is_string($foundPackage['abandoned'])) {
  3610. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  3611. } else {
  3612. $replacement = 'No replacement was suggested';
  3613. }
  3614. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  3615. }
  3616. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  3617. if ($foundPackage['name'] === $package) {
  3618. $exactMatch = true;
  3619. break;
  3620. }
  3621. }
  3622. if (!$exactMatch) {
  3623. $io->writeError(array(
  3624. '',
  3625. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3626. '',
  3627. ));
  3628. $io->writeError($choices);
  3629. $io->writeError('');
  3630. $validator = function ($selection) use ($matches, $versionParser) {
  3631. if ('' === $selection) {
  3632. return false;
  3633. }
  3634. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3635. $package = $matches[(int) $selection];
  3636. return $package['name'];
  3637. }
  3638. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3639. if (isset($packageMatches['version'])) {
  3640. $versionParser->parseConstraints($packageMatches['version']);
  3641. return $packageMatches['name'].' '.$packageMatches['version'];
  3642. }
  3643. return $packageMatches['name'];
  3644. }
  3645. throw new \Exception('Not a valid selection');
  3646. };
  3647. $package = $io->askAndValidate(
  3648. 'Enter package # to add, or the complete package name if it is not listed: ',
  3649. $validator,
  3650. 3,
  3651. false
  3652. );
  3653. }
  3654. if (false !== $package && false === strpos($package, ' ')) {
  3655. $validator = function ($input) {
  3656. $input = trim($input);
  3657. return $input ?: false;
  3658. };
  3659. $constraint = $io->askAndValidate(
  3660. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3661. $validator,
  3662. 3,
  3663. false
  3664. );
  3665. if (false === $constraint) {
  3666. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  3667. $io->writeError(sprintf(
  3668. 'Using version <info>%s</info> for <info>%s</info>',
  3669. $constraint,
  3670. $package
  3671. ));
  3672. }
  3673. $package .= ' '.$constraint;
  3674. }
  3675. if (false !== $package) {
  3676. $requires[] = $package;
  3677. }
  3678. }
  3679. }
  3680. return $requires;
  3681. }
  3682. protected function formatAuthors($author)
  3683. {
  3684. return array($this->parseAuthorString($author));
  3685. }
  3686. protected function formatRequirements(array $requirements)
  3687. {
  3688. $requires = array();
  3689. $requirements = $this->normalizeRequirements($requirements);
  3690. foreach ($requirements as $requirement) {
  3691. $requires[$requirement['name']] = $requirement['version'];
  3692. }
  3693. return $requires;
  3694. }
  3695. protected function getGitConfig()
  3696. {
  3697. if (null !== $this->gitConfig) {
  3698. return $this->gitConfig;
  3699. }
  3700. $finder = new ExecutableFinder();
  3701. $gitBin = $finder->find('git');
  3702. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3703. $cmd->run();
  3704. if ($cmd->isSuccessful()) {
  3705. $this->gitConfig = array();
  3706. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3707. foreach ($matches as $match) {
  3708. $this->gitConfig[$match[1]] = $match[2];
  3709. }
  3710. return $this->gitConfig;
  3711. }
  3712. return $this->gitConfig = array();
  3713. }
  3714. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3715. {
  3716. if (!file_exists($ignoreFile)) {
  3717. return false;
  3718. }
  3719. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3720. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3721. foreach ($lines as $line) {
  3722. if (preg_match($pattern, $line)) {
  3723. return true;
  3724. }
  3725. }
  3726. return false;
  3727. }
  3728. protected function normalizeRequirements(array $requirements)
  3729. {
  3730. $parser = new VersionParser();
  3731. return $parser->parseNameVersionPairs($requirements);
  3732. }
  3733. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3734. {
  3735. $contents = "";
  3736. if (file_exists($ignoreFile)) {
  3737. $contents = file_get_contents($ignoreFile);
  3738. if ("\n" !== substr($contents, 0, -1)) {
  3739. $contents .= "\n";
  3740. }
  3741. }
  3742. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3743. }
  3744. protected function isValidEmail($email)
  3745. {
  3746. if (!function_exists('filter_var')) {
  3747. return true;
  3748. }
  3749. if (PHP_VERSION_ID < 50303) {
  3750. return true;
  3751. }
  3752. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3753. }
  3754. private function getPool(InputInterface $input, $minimumStability = null)
  3755. {
  3756. $key = $minimumStability ?: 'default';
  3757. if (!isset($this->pools[$key])) {
  3758. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  3759. $pool->addRepository($this->getRepos());
  3760. }
  3761. return $this->pools[$key];
  3762. }
  3763. private function getMinimumStability(InputInterface $input)
  3764. {
  3765. if ($input->hasOption('stability')) {
  3766. return $input->getOption('stability') ?: 'stable';
  3767. }
  3768. $file = Factory::getComposerFile();
  3769. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3770. if (!empty($composer['minimum-stability'])) {
  3771. return $composer['minimum-stability'];
  3772. }
  3773. }
  3774. return 'stable';
  3775. }
  3776. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null)
  3777. {
  3778. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  3779. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3780. if ($input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs')) {
  3781. $phpVersion = null;
  3782. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3783. }
  3784. if (!$package) {
  3785. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  3786. throw new \InvalidArgumentException(sprintf(
  3787. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)', $name, $requiredVersion, $phpVersion
  3788. ));
  3789. }
  3790. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  3791. throw new \InvalidArgumentException(sprintf(
  3792. 'Could not find package %s in a version matching %s', $name, $requiredVersion
  3793. ));
  3794. }
  3795. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  3796. throw new \InvalidArgumentException(sprintf(
  3797. 'Could not find package %s in any version matching your PHP version (%s)', $name, $phpVersion
  3798. ));
  3799. }
  3800. $similar = $this->findSimilar($name);
  3801. if ($similar) {
  3802. if ($requiredVersion === null && in_array($name, $similar, true)) {
  3803. throw new \InvalidArgumentException(sprintf(
  3804. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  3805. $name,
  3806. $this->getMinimumStability($input)
  3807. ));
  3808. }
  3809. throw new \InvalidArgumentException(sprintf(
  3810. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  3811. $name,
  3812. implode("\n ", $similar)
  3813. ));
  3814. }
  3815. throw new \InvalidArgumentException(sprintf(
  3816. '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).',
  3817. $name,
  3818. $this->getMinimumStability($input)
  3819. ));
  3820. }
  3821. return array(
  3822. $package->getPrettyName(),
  3823. $versionSelector->findRecommendedRequireVersion($package)
  3824. );
  3825. }
  3826. private function findSimilar($package)
  3827. {
  3828. try {
  3829. $results = $this->repos->search($package);
  3830. } catch (\Exception $e) {
  3831. return array();
  3832. }
  3833. $similarPackages = array();
  3834. foreach ($results as $result) {
  3835. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  3836. }
  3837. asort($similarPackages);
  3838. return array_keys(array_slice($similarPackages, 0, 5));
  3839. }
  3840. }
  3841. <?php
  3842. namespace Composer\Command;
  3843. use Composer\Installer;
  3844. use Composer\Plugin\CommandEvent;
  3845. use Composer\Plugin\PluginEvents;
  3846. use Symfony\Component\Console\Input\InputInterface;
  3847. use Symfony\Component\Console\Input\InputOption;
  3848. use Symfony\Component\Console\Input\InputArgument;
  3849. use Symfony\Component\Console\Output\OutputInterface;
  3850. class InstallCommand extends BaseCommand
  3851. {
  3852. protected function configure()
  3853. {
  3854. $this
  3855. ->setName('install')
  3856. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  3857. ->setDefinition(array(
  3858. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3859. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  3860. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  3861. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  3862. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  3863. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  3864. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  3865. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3866. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3867. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  3868. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  3869. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3870. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3871. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3872. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3873. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  3874. ))
  3875. ->setHelp(<<<EOT
  3876. The <info>install</info> command reads the composer.lock file from
  3877. the current directory, processes it, and downloads and installs all the
  3878. libraries and dependencies outlined in that file. If the file does not
  3879. exist it will look for composer.json and do the same.
  3880. <info>php composer.phar install</info>
  3881. EOT
  3882. )
  3883. ;
  3884. }
  3885. protected function execute(InputInterface $input, OutputInterface $output)
  3886. {
  3887. $io = $this->getIO();
  3888. if ($args = $input->getArgument('packages')) {
  3889. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  3890. return 1;
  3891. }
  3892. if ($input->getOption('no-custom-installers')) {
  3893. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  3894. $input->setOption('no-plugins', true);
  3895. }
  3896. if ($input->getOption('dev')) {
  3897. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  3898. }
  3899. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3900. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3901. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  3902. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3903. $install = Installer::create($io, $composer);
  3904. $config = $composer->getConfig();
  3905. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  3906. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  3907. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3908. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  3909. $install
  3910. ->setDryRun($input->getOption('dry-run'))
  3911. ->setVerbose($input->getOption('verbose'))
  3912. ->setPreferSource($preferSource)
  3913. ->setPreferDist($preferDist)
  3914. ->setDevMode(!$input->getOption('no-dev'))
  3915. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  3916. ->setRunScripts(!$input->getOption('no-scripts'))
  3917. ->setSkipSuggest($input->getOption('no-suggest'))
  3918. ->setOptimizeAutoloader($optimize)
  3919. ->setClassMapAuthoritative($authoritative)
  3920. ->setApcuAutoloader($apcu)
  3921. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  3922. ;
  3923. if ($input->getOption('no-plugins')) {
  3924. $install->disablePlugins();
  3925. }
  3926. return $install->run();
  3927. }
  3928. }
  3929. <?php
  3930. namespace Composer\Command;
  3931. use Composer\Json\JsonFile;
  3932. use Composer\Plugin\CommandEvent;
  3933. use Composer\Plugin\PluginEvents;
  3934. use Composer\Package\PackageInterface;
  3935. use Composer\Repository\RepositoryInterface;
  3936. use Symfony\Component\Console\Helper\Table;
  3937. use Symfony\Component\Console\Input\InputInterface;
  3938. use Symfony\Component\Console\Input\InputOption;
  3939. use Symfony\Component\Console\Output\OutputInterface;
  3940. class LicensesCommand extends BaseCommand
  3941. {
  3942. protected function configure()
  3943. {
  3944. $this
  3945. ->setName('licenses')
  3946. ->setDescription('Shows information about licenses of dependencies.')
  3947. ->setDefinition(array(
  3948. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  3949. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  3950. ))
  3951. ->setHelp(<<<EOT
  3952. The license command displays detailed information about the licenses of
  3953. the installed dependencies.
  3954. EOT
  3955. )
  3956. ;
  3957. }
  3958. protected function execute(InputInterface $input, OutputInterface $output)
  3959. {
  3960. $composer = $this->getComposer();
  3961. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  3962. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3963. $root = $composer->getPackage();
  3964. $repo = $composer->getRepositoryManager()->getLocalRepository();
  3965. if ($input->getOption('no-dev')) {
  3966. $packages = $this->filterRequiredPackages($repo, $root);
  3967. } else {
  3968. $packages = $this->appendPackages($repo->getPackages(), array());
  3969. }
  3970. ksort($packages);
  3971. $io = $this->getIO();
  3972. switch ($format = $input->getOption('format')) {
  3973. case 'text':
  3974. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  3975. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  3976. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  3977. $io->write('Dependencies:');
  3978. $io->write('');
  3979. $table = new Table($output);
  3980. $table->setStyle('compact');
  3981. $tableStyle = $table->getStyle();
  3982. $tableStyle->setVerticalBorderChar('');
  3983. $tableStyle->setCellRowContentFormat('%s ');
  3984. $table->setHeaders(array('Name', 'Version', 'License'));
  3985. foreach ($packages as $package) {
  3986. $table->addRow(array(
  3987. $package->getPrettyName(),
  3988. $package->getFullPrettyVersion(),
  3989. implode(', ', $package->getLicense()) ?: 'none',
  3990. ));
  3991. }
  3992. $table->render();
  3993. break;
  3994. case 'json':
  3995. $dependencies = array();
  3996. foreach ($packages as $package) {
  3997. $dependencies[$package->getPrettyName()] = array(
  3998. 'version' => $package->getFullPrettyVersion(),
  3999. 'license' => $package->getLicense(),
  4000. );
  4001. }
  4002. $io->write(JsonFile::encode(array(
  4003. 'name' => $root->getPrettyName(),
  4004. 'version' => $root->getFullPrettyVersion(),
  4005. 'license' => $root->getLicense(),
  4006. 'dependencies' => $dependencies,
  4007. )));
  4008. break;
  4009. default:
  4010. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4011. }
  4012. }
  4013. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4014. {
  4015. $requires = array_keys($package->getRequires());
  4016. $packageListNames = array_keys($bucket);
  4017. $packages = array_filter(
  4018. $repo->getPackages(),
  4019. function ($package) use ($requires, $packageListNames) {
  4020. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4021. }
  4022. );
  4023. $bucket = $this->appendPackages($packages, $bucket);
  4024. foreach ($packages as $package) {
  4025. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4026. }
  4027. return $bucket;
  4028. }
  4029. public function appendPackages(array $packages, array $bucket)
  4030. {
  4031. foreach ($packages as $package) {
  4032. $bucket[$package->getName()] = $package;
  4033. }
  4034. return $bucket;
  4035. }
  4036. }
  4037. <?php
  4038. namespace Composer\Command;
  4039. use Symfony\Component\Console\Input\InputInterface;
  4040. use Symfony\Component\Console\Input\InputArgument;
  4041. use Symfony\Component\Console\Input\ArrayInput;
  4042. use Symfony\Component\Console\Input\InputOption;
  4043. use Symfony\Component\Console\Output\OutputInterface;
  4044. class OutdatedCommand extends ShowCommand
  4045. {
  4046. protected function configure()
  4047. {
  4048. $this
  4049. ->setName('outdated')
  4050. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4051. ->setDefinition(array(
  4052. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4053. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4054. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4055. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4056. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4057. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4058. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4059. ))
  4060. ->setHelp(<<<EOT
  4061. The outdated command is just a proxy for `composer show -l`
  4062. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4063. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4064. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4065. compatibility breaks according to semver, so upgrade when you can but it
  4066. may involve work.
  4067. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4068. EOT
  4069. )
  4070. ;
  4071. }
  4072. protected function execute(InputInterface $input, OutputInterface $output)
  4073. {
  4074. $args = array(
  4075. 'show',
  4076. '--latest' => true,
  4077. );
  4078. if (!$input->getOption('all')) {
  4079. $args['--outdated'] = true;
  4080. }
  4081. if ($input->getOption('direct')) {
  4082. $args['--direct'] = true;
  4083. }
  4084. if ($input->getArgument('package')) {
  4085. $args['package'] = $input->getArgument('package');
  4086. }
  4087. if ($input->getOption('strict')) {
  4088. $args['--strict'] = true;
  4089. }
  4090. if ($input->getOption('minor-only')) {
  4091. $args['--minor-only'] = true;
  4092. }
  4093. $args['--format'] = $input->getOption('format');
  4094. $input = new ArrayInput($args);
  4095. return $this->getApplication()->run($input, $output);
  4096. }
  4097. public function isProxyCommand()
  4098. {
  4099. return true;
  4100. }
  4101. }
  4102. <?php
  4103. namespace Composer\Command;
  4104. use Symfony\Component\Console\Input\InputInterface;
  4105. use Symfony\Component\Console\Output\OutputInterface;
  4106. class ProhibitsCommand extends BaseDependencyCommand
  4107. {
  4108. protected function configure()
  4109. {
  4110. parent::configure();
  4111. $this
  4112. ->setName('prohibits')
  4113. ->setAliases(array('why-not'))
  4114. ->setDescription('Shows which packages prevent the given package from being installed.')
  4115. ->setHelp(<<<EOT
  4116. Displays detailed information about why a package cannot be installed.
  4117. <info>php composer.phar prohibits composer/composer</info>
  4118. EOT
  4119. )
  4120. ;
  4121. }
  4122. protected function execute(InputInterface $input, OutputInterface $output)
  4123. {
  4124. return parent::doExecute($input, $output, true);
  4125. }
  4126. }
  4127. <?php
  4128. namespace Composer\Command;
  4129. use Composer\Config\JsonConfigSource;
  4130. use Composer\Installer;
  4131. use Composer\Plugin\CommandEvent;
  4132. use Composer\Plugin\PluginEvents;
  4133. use Composer\Json\JsonFile;
  4134. use Composer\Factory;
  4135. use Symfony\Component\Console\Input\InputInterface;
  4136. use Symfony\Component\Console\Input\InputOption;
  4137. use Symfony\Component\Console\Input\InputArgument;
  4138. use Symfony\Component\Console\Output\OutputInterface;
  4139. class RemoveCommand extends BaseCommand
  4140. {
  4141. protected function configure()
  4142. {
  4143. $this
  4144. ->setName('remove')
  4145. ->setDescription('Removes a package from the require or require-dev.')
  4146. ->setDefinition(array(
  4147. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4148. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4149. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4150. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4151. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4152. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4153. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4154. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4155. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4156. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4157. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4158. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4159. ))
  4160. ->setHelp(<<<EOT
  4161. The <info>remove</info> command removes a package from the current
  4162. list of installed packages
  4163. <info>php composer.phar remove</info>
  4164. EOT
  4165. )
  4166. ;
  4167. }
  4168. protected function execute(InputInterface $input, OutputInterface $output)
  4169. {
  4170. $packages = $input->getArgument('packages');
  4171. $packages = array_map('strtolower', $packages);
  4172. $file = Factory::getComposerFile();
  4173. $jsonFile = new JsonFile($file);
  4174. $composer = $jsonFile->read();
  4175. $composerBackup = file_get_contents($jsonFile->getPath());
  4176. $json = new JsonConfigSource($jsonFile);
  4177. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4178. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4179. $io = $this->getIO();
  4180. if ($input->getOption('update-with-dependencies')) {
  4181. $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>');
  4182. }
  4183. foreach (array('require', 'require-dev') as $linkType) {
  4184. if (isset($composer[$linkType])) {
  4185. foreach ($composer[$linkType] as $name => $version) {
  4186. $composer[$linkType][strtolower($name)] = $name;
  4187. }
  4188. }
  4189. }
  4190. foreach ($packages as $package) {
  4191. if (isset($composer[$type][$package])) {
  4192. $json->removeLink($type, $composer[$type][$package]);
  4193. } elseif (isset($composer[$altType][$package])) {
  4194. $io->writeError('<warning>'.$composer[$altType][$package].' could not be found in '.$type.' but it is present in '.$altType.'</warning>');
  4195. if ($io->isInteractive()) {
  4196. if ($io->askConfirmation('Do you want to remove it from '.$altType.' [<comment>yes</comment>]? ', true)) {
  4197. $json->removeLink($altType, $composer[$altType][$package]);
  4198. }
  4199. }
  4200. } else {
  4201. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4202. }
  4203. }
  4204. if ($input->getOption('no-update')) {
  4205. return 0;
  4206. }
  4207. $this->resetComposer();
  4208. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4209. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4210. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4211. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4212. $install = Installer::create($io, $composer);
  4213. $updateDevMode = !$input->getOption('update-no-dev');
  4214. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4215. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4216. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4217. $install
  4218. ->setVerbose($input->getOption('verbose'))
  4219. ->setDevMode($updateDevMode)
  4220. ->setOptimizeAutoloader($optimize)
  4221. ->setClassMapAuthoritative($authoritative)
  4222. ->setApcuAutoloader($apcu)
  4223. ->setUpdate(true)
  4224. ->setUpdateWhitelist($packages)
  4225. ->setWhitelistTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4226. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4227. ->setRunScripts(!$input->getOption('no-scripts'))
  4228. ;
  4229. $status = $install->run();
  4230. if ($status !== 0) {
  4231. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4232. file_put_contents($jsonFile->getPath(), $composerBackup);
  4233. }
  4234. return $status;
  4235. }
  4236. }
  4237. <?php
  4238. namespace Composer\Command;
  4239. use Symfony\Component\Console\Input\InputInterface;
  4240. use Symfony\Component\Console\Input\InputArgument;
  4241. use Symfony\Component\Console\Input\InputOption;
  4242. use Symfony\Component\Console\Output\OutputInterface;
  4243. use Composer\Factory;
  4244. use Composer\Installer;
  4245. use Composer\Json\JsonFile;
  4246. use Composer\Json\JsonManipulator;
  4247. use Composer\Package\Version\VersionParser;
  4248. use Composer\Plugin\CommandEvent;
  4249. use Composer\Plugin\PluginEvents;
  4250. use Composer\Repository\CompositeRepository;
  4251. use Composer\Repository\PlatformRepository;
  4252. class RequireCommand extends InitCommand
  4253. {
  4254. protected function configure()
  4255. {
  4256. $this
  4257. ->setName('require')
  4258. ->setDescription('Adds required packages to your composer.json and installs them.')
  4259. ->setDefinition(array(
  4260. 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"'),
  4261. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4262. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4263. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4264. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4265. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4266. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4267. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4268. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4269. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4270. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4271. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4272. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4273. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4274. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4275. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4276. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4277. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4278. ))
  4279. ->setHelp(<<<EOT
  4280. The require command adds required packages to your composer.json and installs them.
  4281. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4282. matches to require.
  4283. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4284. If you do not want to install the new dependencies immediately you can call it with --no-update
  4285. EOT
  4286. )
  4287. ;
  4288. }
  4289. protected function execute(InputInterface $input, OutputInterface $output)
  4290. {
  4291. $file = Factory::getComposerFile();
  4292. $io = $this->getIO();
  4293. $newlyCreated = !file_exists($file);
  4294. if ($newlyCreated && !file_put_contents($file, "{\n}\n")) {
  4295. $io->writeError('<error>'.$file.' could not be created.</error>');
  4296. return 1;
  4297. }
  4298. if (!is_readable($file)) {
  4299. $io->writeError('<error>'.$file.' is not readable.</error>');
  4300. return 1;
  4301. }
  4302. if (!is_writable($file)) {
  4303. $io->writeError('<error>'.$file.' is not writable.</error>');
  4304. return 1;
  4305. }
  4306. if (filesize($file) === 0) {
  4307. file_put_contents($file, "{\n}\n");
  4308. }
  4309. $json = new JsonFile($file);
  4310. $composerBackup = file_get_contents($json->getPath());
  4311. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4312. $repos = $composer->getRepositoryManager()->getRepositories();
  4313. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4314. $this->repos = new CompositeRepository(array_merge(
  4315. array(new PlatformRepository(array(), $platformOverrides)),
  4316. $repos
  4317. ));
  4318. if ($composer->getPackage()->getPreferStable()) {
  4319. $preferredStability = 'stable';
  4320. } else {
  4321. $preferredStability = $composer->getPackage()->getMinimumStability();
  4322. }
  4323. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4324. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability);
  4325. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4326. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4327. $requirements = $this->formatRequirements($requirements);
  4328. $versionParser = new VersionParser();
  4329. foreach ($requirements as $constraint) {
  4330. $versionParser->parseConstraints($constraint);
  4331. }
  4332. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4333. if (!$this->updateFileCleanly($json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4334. $composerDefinition = $json->read();
  4335. foreach ($requirements as $package => $version) {
  4336. $composerDefinition[$requireKey][$package] = $version;
  4337. unset($composerDefinition[$removeKey][$package]);
  4338. }
  4339. $json->write($composerDefinition);
  4340. }
  4341. $io->writeError('<info>'.$file.' has been '.($newlyCreated ? 'created' : 'updated').'</info>');
  4342. if ($input->getOption('no-update')) {
  4343. return 0;
  4344. }
  4345. $updateDevMode = !$input->getOption('update-no-dev');
  4346. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4347. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4348. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4349. $this->resetComposer();
  4350. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4351. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4352. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4353. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4354. $install = Installer::create($io, $composer);
  4355. $install
  4356. ->setVerbose($input->getOption('verbose'))
  4357. ->setPreferSource($input->getOption('prefer-source'))
  4358. ->setPreferDist($input->getOption('prefer-dist'))
  4359. ->setDevMode($updateDevMode)
  4360. ->setRunScripts(!$input->getOption('no-scripts'))
  4361. ->setSkipSuggest($input->getOption('no-suggest'))
  4362. ->setOptimizeAutoloader($optimize)
  4363. ->setClassMapAuthoritative($authoritative)
  4364. ->setApcuAutoloader($apcu)
  4365. ->setUpdate(true)
  4366. ->setUpdateWhitelist(array_keys($requirements))
  4367. ->setWhitelistTransitiveDependencies($input->getOption('update-with-dependencies'))
  4368. ->setWhitelistAllDependencies($input->getOption('update-with-all-dependencies'))
  4369. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4370. ->setPreferStable($input->getOption('prefer-stable'))
  4371. ->setPreferLowest($input->getOption('prefer-lowest'))
  4372. ;
  4373. $status = $install->run();
  4374. if ($status !== 0) {
  4375. if ($newlyCreated) {
  4376. $io->writeError("\n".'<error>Installation failed, deleting '.$file.'.</error>');
  4377. unlink($json->getPath());
  4378. } else {
  4379. $io->writeError("\n".'<error>Installation failed, reverting '.$file.' to its original content.</error>');
  4380. file_put_contents($json->getPath(), $composerBackup);
  4381. }
  4382. }
  4383. return $status;
  4384. }
  4385. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4386. {
  4387. $contents = file_get_contents($json->getPath());
  4388. $manipulator = new JsonManipulator($contents);
  4389. foreach ($new as $package => $constraint) {
  4390. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4391. return false;
  4392. }
  4393. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4394. return false;
  4395. }
  4396. }
  4397. file_put_contents($json->getPath(), $manipulator->getContents());
  4398. return true;
  4399. }
  4400. protected function interact(InputInterface $input, OutputInterface $output)
  4401. {
  4402. return;
  4403. }
  4404. }
  4405. <?php
  4406. namespace Composer\Command;
  4407. use Composer\Script\Event as ScriptEvent;
  4408. use Composer\Script\ScriptEvents;
  4409. use Composer\Util\ProcessExecutor;
  4410. use Symfony\Component\Console\Input\InputInterface;
  4411. use Symfony\Component\Console\Input\InputOption;
  4412. use Symfony\Component\Console\Input\InputArgument;
  4413. use Symfony\Component\Console\Output\OutputInterface;
  4414. use Symfony\Component\Console\Helper\Table;
  4415. class RunScriptCommand extends BaseCommand
  4416. {
  4417. protected $scriptEvents = array(
  4418. ScriptEvents::PRE_INSTALL_CMD,
  4419. ScriptEvents::POST_INSTALL_CMD,
  4420. ScriptEvents::PRE_UPDATE_CMD,
  4421. ScriptEvents::POST_UPDATE_CMD,
  4422. ScriptEvents::PRE_STATUS_CMD,
  4423. ScriptEvents::POST_STATUS_CMD,
  4424. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4425. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4426. ScriptEvents::PRE_ARCHIVE_CMD,
  4427. ScriptEvents::POST_ARCHIVE_CMD,
  4428. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4429. ScriptEvents::POST_AUTOLOAD_DUMP,
  4430. );
  4431. protected function configure()
  4432. {
  4433. $this
  4434. ->setName('run-script')
  4435. ->setDescription('Runs the scripts defined in composer.json.')
  4436. ->setDefinition(array(
  4437. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4438. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4439. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4440. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4441. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4442. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4443. ))
  4444. ->setHelp(<<<EOT
  4445. The <info>run-script</info> command runs scripts defined in composer.json:
  4446. <info>php composer.phar run-script post-update-cmd</info>
  4447. EOT
  4448. )
  4449. ;
  4450. }
  4451. protected function execute(InputInterface $input, OutputInterface $output)
  4452. {
  4453. if ($input->getOption('list')) {
  4454. return $this->listScripts($output);
  4455. } elseif (!$input->getArgument('script')) {
  4456. throw new \RuntimeException('Missing required argument "script"');
  4457. }
  4458. $script = $input->getArgument('script');
  4459. if (!in_array($script, $this->scriptEvents)) {
  4460. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4461. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4462. }
  4463. }
  4464. $composer = $this->getComposer();
  4465. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  4466. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  4467. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  4468. if (!$hasListeners) {
  4469. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4470. }
  4471. $args = $input->getArgument('args');
  4472. if (null !== $timeout = $input->getOption('timeout')) {
  4473. if (!ctype_digit($timeout)) {
  4474. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4475. }
  4476. ProcessExecutor::setTimeout((int) $timeout);
  4477. }
  4478. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  4479. }
  4480. protected function listScripts(OutputInterface $output)
  4481. {
  4482. $scripts = $this->getComposer()->getPackage()->getScripts();
  4483. if (!count($scripts)) {
  4484. return 0;
  4485. }
  4486. $io = $this->getIO();
  4487. $io->writeError('<info>scripts:</info>');
  4488. $table = array();
  4489. foreach ($scripts as $name => $script) {
  4490. $cmd = $this->getApplication()->find($name);
  4491. $description = '';
  4492. if ($cmd instanceof ScriptAliasCommand) {
  4493. $description = $cmd->getDescription();
  4494. }
  4495. $table[] = array(' '.$name, $description);
  4496. }
  4497. $renderer = new Table($output);
  4498. $renderer->setStyle('compact');
  4499. $rendererStyle = $renderer->getStyle();
  4500. $rendererStyle->setVerticalBorderChar('');
  4501. $rendererStyle->setCellRowContentFormat('%s ');
  4502. $renderer->setRows($table)->render();
  4503. return 0;
  4504. }
  4505. }
  4506. <?php
  4507. namespace Composer\Command;
  4508. use Symfony\Component\Console\Input\InputInterface;
  4509. use Symfony\Component\Console\Input\InputOption;
  4510. use Symfony\Component\Console\Input\InputArgument;
  4511. use Symfony\Component\Console\Output\OutputInterface;
  4512. class ScriptAliasCommand extends BaseCommand
  4513. {
  4514. private $script;
  4515. private $description;
  4516. public function __construct($script, $description)
  4517. {
  4518. $this->script = $script;
  4519. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  4520. parent::__construct();
  4521. }
  4522. protected function configure()
  4523. {
  4524. $this
  4525. ->setName($this->script)
  4526. ->setDescription($this->description)
  4527. ->setDefinition(array(
  4528. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4529. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4530. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4531. ))
  4532. ->setHelp(<<<EOT
  4533. The <info>run-script</info> command runs scripts defined in composer.json:
  4534. <info>php composer.phar run-script post-update-cmd</info>
  4535. EOT
  4536. )
  4537. ;
  4538. }
  4539. protected function execute(InputInterface $input, OutputInterface $output)
  4540. {
  4541. $composer = $this->getComposer();
  4542. $args = $input->getArguments();
  4543. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4544. }
  4545. }
  4546. <?php
  4547. namespace Composer\Command;
  4548. use Composer\Factory;
  4549. use Symfony\Component\Console\Input\InputInterface;
  4550. use Symfony\Component\Console\Input\InputArgument;
  4551. use Symfony\Component\Console\Input\InputOption;
  4552. use Symfony\Component\Console\Output\OutputInterface;
  4553. use Composer\Repository\CompositeRepository;
  4554. use Composer\Repository\PlatformRepository;
  4555. use Composer\Repository\RepositoryInterface;
  4556. use Composer\Plugin\CommandEvent;
  4557. use Composer\Plugin\PluginEvents;
  4558. class SearchCommand extends BaseCommand
  4559. {
  4560. protected $matches;
  4561. protected $lowMatches = array();
  4562. protected $tokens;
  4563. protected $output;
  4564. protected $onlyName;
  4565. protected function configure()
  4566. {
  4567. $this
  4568. ->setName('search')
  4569. ->setDescription('Searches for packages.')
  4570. ->setDefinition(array(
  4571. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4572. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4573. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4574. ))
  4575. ->setHelp(<<<EOT
  4576. The search command searches for packages by its name
  4577. <info>php composer.phar search symfony composer</info>
  4578. EOT
  4579. )
  4580. ;
  4581. }
  4582. protected function execute(InputInterface $input, OutputInterface $output)
  4583. {
  4584. $platformRepo = new PlatformRepository;
  4585. $io = $this->getIO();
  4586. if (!($composer = $this->getComposer(false))) {
  4587. $composer = Factory::create($this->getIO(), array());
  4588. }
  4589. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4590. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4591. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4592. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4593. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4594. $onlyName = $input->getOption('only-name');
  4595. $type = $input->getOption('type') ?: null;
  4596. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4597. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4598. foreach ($results as $result) {
  4599. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4600. }
  4601. }
  4602. }
  4603. <?php
  4604. namespace Composer\Command;
  4605. use Composer\Composer;
  4606. use Composer\Factory;
  4607. use Composer\Config;
  4608. use Composer\Util\Filesystem;
  4609. use Composer\SelfUpdate\Keys;
  4610. use Composer\SelfUpdate\Versions;
  4611. use Composer\IO\IOInterface;
  4612. use Composer\Downloader\FilesystemException;
  4613. use Symfony\Component\Console\Input\InputInterface;
  4614. use Symfony\Component\Console\Input\InputOption;
  4615. use Symfony\Component\Console\Input\InputArgument;
  4616. use Symfony\Component\Console\Output\OutputInterface;
  4617. use Symfony\Component\Finder\Finder;
  4618. class SelfUpdateCommand extends BaseCommand
  4619. {
  4620. const HOMEPAGE = 'getcomposer.org';
  4621. const OLD_INSTALL_EXT = '-old.phar';
  4622. protected function configure()
  4623. {
  4624. $this
  4625. ->setName('self-update')
  4626. ->setAliases(array('selfupdate'))
  4627. ->setDescription('Updates composer.phar to the latest version.')
  4628. ->setDefinition(array(
  4629. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4630. 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'),
  4631. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4632. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4633. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4634. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  4635. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  4636. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  4637. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  4638. ))
  4639. ->setHelp(<<<EOT
  4640. The <info>self-update</info> command checks getcomposer.org for newer
  4641. versions of composer and if found, installs the latest.
  4642. <info>php composer.phar self-update</info>
  4643. EOT
  4644. )
  4645. ;
  4646. }
  4647. protected function execute(InputInterface $input, OutputInterface $output)
  4648. {
  4649. $config = Factory::createConfig();
  4650. if ($config->get('disable-tls') === true) {
  4651. $baseUrl = 'http://' . self::HOMEPAGE;
  4652. } else {
  4653. $baseUrl = 'https://' . self::HOMEPAGE;
  4654. }
  4655. $io = $this->getIO();
  4656. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4657. $versionsUtil = new Versions($config, $remoteFilesystem);
  4658. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  4659. if ($input->getOption($channel)) {
  4660. $versionsUtil->setChannel($channel);
  4661. }
  4662. }
  4663. if ($input->getOption('set-channel-only')) {
  4664. return 0;
  4665. }
  4666. $cacheDir = $config->get('cache-dir');
  4667. $rollbackDir = $config->get('data-dir');
  4668. $home = $config->get('home');
  4669. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4670. if ($input->getOption('update-keys')) {
  4671. return $this->fetchKeys($io, $config);
  4672. }
  4673. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4674. if (!is_writable($tmpDir)) {
  4675. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4676. }
  4677. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  4678. $composeUser = posix_getpwuid(posix_geteuid());
  4679. $homeOwner = posix_getpwuid(fileowner($home));
  4680. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  4681. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  4682. }
  4683. }
  4684. if ($input->getOption('rollback')) {
  4685. return $this->rollback($output, $rollbackDir, $localFilename);
  4686. }
  4687. $latest = $versionsUtil->getLatest();
  4688. $latestVersion = $latest['version'];
  4689. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4690. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4691. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4692. return 1;
  4693. }
  4694. if (Composer::VERSION === $updateVersion) {
  4695. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  4696. if ($input->getOption('clean-backups')) {
  4697. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  4698. }
  4699. return 0;
  4700. }
  4701. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  4702. $backupFile = sprintf(
  4703. '%s/%s-%s%s',
  4704. $rollbackDir,
  4705. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  4706. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  4707. self::OLD_INSTALL_EXT
  4708. );
  4709. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  4710. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  4711. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  4712. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  4713. $io->writeError(' ', false);
  4714. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  4715. $io->writeError('');
  4716. if (!file_exists($tempFilename) || !$signature) {
  4717. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  4718. return 1;
  4719. }
  4720. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  4721. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  4722. } else {
  4723. if (!extension_loaded('openssl')) {
  4724. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  4725. . '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.');
  4726. }
  4727. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  4728. if (!file_exists($sigFile)) {
  4729. file_put_contents($home.'/keys.dev.pub', <<<DEVPUBKEY
  4730. -----BEGIN PUBLIC KEY-----
  4731. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  4732. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  4733. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  4734. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  4735. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  4736. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  4737. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  4738. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  4739. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  4740. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  4741. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  4742. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  4743. -----END PUBLIC KEY-----
  4744. DEVPUBKEY
  4745. );
  4746. file_put_contents($home.'/keys.tags.pub', <<<TAGSPUBKEY
  4747. -----BEGIN PUBLIC KEY-----
  4748. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  4749. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  4750. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  4751. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  4752. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  4753. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  4754. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  4755. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  4756. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  4757. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  4758. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  4759. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  4760. -----END PUBLIC KEY-----
  4761. TAGSPUBKEY
  4762. );
  4763. }
  4764. $pubkeyid = openssl_pkey_get_public($sigFile);
  4765. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  4766. if (!in_array('SHA384', openssl_get_md_methods())) {
  4767. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  4768. }
  4769. $signature = json_decode($signature, true);
  4770. $signature = base64_decode($signature['sha384']);
  4771. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  4772. openssl_free_key($pubkeyid);
  4773. if (!$verified) {
  4774. 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');
  4775. }
  4776. }
  4777. if ($input->getOption('clean-backups')) {
  4778. $this->cleanBackups($rollbackDir);
  4779. }
  4780. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  4781. @unlink($tempFilename);
  4782. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  4783. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  4784. return 1;
  4785. }
  4786. if (file_exists($backupFile)) {
  4787. $io->writeError(sprintf(
  4788. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  4789. Composer::VERSION
  4790. ));
  4791. } else {
  4792. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  4793. }
  4794. }
  4795. protected function fetchKeys(IOInterface $io, Config $config)
  4796. {
  4797. if (!$io->isInteractive()) {
  4798. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  4799. }
  4800. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  4801. $validator = function ($value) {
  4802. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  4803. throw new \UnexpectedValueException('Invalid input');
  4804. }
  4805. return trim($value)."\n";
  4806. };
  4807. $devKey = '';
  4808. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  4809. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  4810. while ($line = $io->ask('')) {
  4811. $devKey .= trim($line)."\n";
  4812. if (trim($line) === '-----END PUBLIC KEY-----') {
  4813. break;
  4814. }
  4815. }
  4816. }
  4817. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  4818. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4819. $tagsKey = '';
  4820. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  4821. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  4822. while ($line = $io->ask('')) {
  4823. $tagsKey .= trim($line)."\n";
  4824. if (trim($line) === '-----END PUBLIC KEY-----') {
  4825. break;
  4826. }
  4827. }
  4828. }
  4829. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  4830. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4831. $io->write('Public keys stored in '.$config->get('home'));
  4832. }
  4833. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  4834. {
  4835. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  4836. if (!$rollbackVersion) {
  4837. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  4838. }
  4839. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  4840. if (!is_file($oldFile)) {
  4841. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  4842. }
  4843. if (!is_readable($oldFile)) {
  4844. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  4845. }
  4846. $io = $this->getIO();
  4847. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  4848. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  4849. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  4850. return 1;
  4851. }
  4852. return 0;
  4853. }
  4854. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  4855. {
  4856. try {
  4857. @chmod($newFilename, fileperms($localFilename));
  4858. if (!ini_get('phar.readonly')) {
  4859. $phar = new \Phar($newFilename);
  4860. unset($phar);
  4861. }
  4862. if ($backupTarget && file_exists($localFilename)) {
  4863. @copy($localFilename, $backupTarget);
  4864. }
  4865. rename($newFilename, $localFilename);
  4866. return null;
  4867. } catch (\Exception $e) {
  4868. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  4869. throw $e;
  4870. }
  4871. return $e;
  4872. }
  4873. }
  4874. protected function cleanBackups($rollbackDir, $except = null)
  4875. {
  4876. $finder = $this->getOldInstallationFinder($rollbackDir);
  4877. $io = $this->getIO();
  4878. $fs = new Filesystem;
  4879. foreach ($finder as $file) {
  4880. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  4881. continue;
  4882. }
  4883. $file = (string) $file;
  4884. $io->writeError('<info>Removing: '.$file.'</info>');
  4885. $fs->remove($file);
  4886. }
  4887. }
  4888. protected function getLastBackupVersion($rollbackDir)
  4889. {
  4890. $finder = $this->getOldInstallationFinder($rollbackDir);
  4891. $finder->sortByName();
  4892. $files = iterator_to_array($finder);
  4893. if (count($files)) {
  4894. return basename(end($files), self::OLD_INSTALL_EXT);
  4895. }
  4896. return false;
  4897. }
  4898. protected function getOldInstallationFinder($rollbackDir)
  4899. {
  4900. $finder = Finder::create()
  4901. ->depth(0)
  4902. ->files()
  4903. ->name('*' . self::OLD_INSTALL_EXT)
  4904. ->in($rollbackDir);
  4905. return $finder;
  4906. }
  4907. }
  4908. <?php
  4909. namespace Composer\Command;
  4910. use Composer\Composer;
  4911. use Composer\DependencyResolver\DefaultPolicy;
  4912. use Composer\DependencyResolver\Pool;
  4913. use Composer\Json\JsonFile;
  4914. use Composer\Package\BasePackage;
  4915. use Composer\Package\CompletePackageInterface;
  4916. use Composer\Package\PackageInterface;
  4917. use Composer\Package\Version\VersionParser;
  4918. use Composer\Package\Version\VersionSelector;
  4919. use Composer\Plugin\CommandEvent;
  4920. use Composer\Plugin\PluginEvents;
  4921. use Composer\Repository\ArrayRepository;
  4922. use Composer\Repository\ComposerRepository;
  4923. use Composer\Repository\CompositeRepository;
  4924. use Composer\Repository\PlatformRepository;
  4925. use Composer\Repository\RepositoryFactory;
  4926. use Composer\Repository\RepositoryInterface;
  4927. use Composer\Semver\Constraint\ConstraintInterface;
  4928. use Composer\Semver\Semver;
  4929. use Composer\Spdx\SpdxLicenses;
  4930. use Composer\Util\Platform;
  4931. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  4932. use Symfony\Component\Console\Input\InputArgument;
  4933. use Symfony\Component\Console\Input\InputInterface;
  4934. use Symfony\Component\Console\Input\InputOption;
  4935. use Symfony\Component\Console\Output\OutputInterface;
  4936. use Symfony\Component\Console\Terminal;
  4937. class ShowCommand extends BaseCommand
  4938. {
  4939. protected $versionParser;
  4940. protected $colors;
  4941. private $pool;
  4942. protected function configure()
  4943. {
  4944. $this
  4945. ->setName('show')
  4946. ->setAliases(array('info'))
  4947. ->setDescription('Shows information about packages.')
  4948. ->setDefinition(array(
  4949. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4950. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  4951. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  4952. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  4953. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  4954. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  4955. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  4956. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  4957. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  4958. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  4959. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  4960. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  4961. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4962. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4963. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4964. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4965. ))
  4966. ->setHelp(<<<EOT
  4967. The show command displays detailed information about a package, or
  4968. lists all packages available.
  4969. EOT
  4970. )
  4971. ;
  4972. }
  4973. protected function execute(InputInterface $input, OutputInterface $output)
  4974. {
  4975. $this->versionParser = new VersionParser;
  4976. if ($input->getOption('tree')) {
  4977. $this->initStyles($output);
  4978. }
  4979. $composer = $this->getComposer(false);
  4980. $io = $this->getIO();
  4981. if ($input->getOption('installed')) {
  4982. $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>');
  4983. }
  4984. if ($input->getOption('outdated')) {
  4985. $input->setOption('latest', true);
  4986. }
  4987. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  4988. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  4989. return 1;
  4990. }
  4991. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  4992. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  4993. return 1;
  4994. }
  4995. $format = $input->getOption('format');
  4996. if (!in_array($format, array('text', 'json'))) {
  4997. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4998. return 1;
  4999. }
  5000. $platformOverrides = array();
  5001. if ($composer) {
  5002. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  5003. }
  5004. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  5005. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  5006. if ($input->getOption('self')) {
  5007. $package = $this->getComposer()->getPackage();
  5008. $repos = $installedRepo = new ArrayRepository(array($package));
  5009. } elseif ($input->getOption('platform')) {
  5010. $repos = $installedRepo = $platformRepo;
  5011. } elseif ($input->getOption('available')) {
  5012. $installedRepo = $platformRepo;
  5013. if ($composer) {
  5014. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5015. } else {
  5016. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5017. $repos = new CompositeRepository($defaultRepos);
  5018. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5019. }
  5020. } elseif ($input->getOption('all') && $composer) {
  5021. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5022. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5023. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5024. } elseif ($input->getOption('all')) {
  5025. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5026. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5027. $installedRepo = $platformRepo;
  5028. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5029. } else {
  5030. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5031. $rootPkg = $this->getComposer()->getPackage();
  5032. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5033. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5034. }
  5035. }
  5036. if ($composer) {
  5037. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5038. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5039. }
  5040. if ($input->getOption('latest') && null === $composer) {
  5041. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5042. $input->setOption('latest', false);
  5043. }
  5044. $packageFilter = $input->getArgument('package');
  5045. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5046. if ('json' === $format) {
  5047. $io->writeError('Format "json" is only supported for package listings, falling back to format "text"');
  5048. }
  5049. if (empty($package)) {
  5050. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5051. if (empty($package)) {
  5052. $options = $input->getOptions();
  5053. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5054. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5055. }
  5056. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5057. return 1;
  5058. }
  5059. } else {
  5060. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5061. }
  5062. $exitCode = 0;
  5063. if ($input->getOption('tree')) {
  5064. $this->displayPackageTree($package, $installedRepo, $repos);
  5065. } else {
  5066. $latestPackage = null;
  5067. if ($input->getOption('latest')) {
  5068. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5069. }
  5070. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5071. $exitCode = 1;
  5072. }
  5073. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  5074. $this->printLinks($package, 'requires');
  5075. $this->printLinks($package, 'devRequires', 'requires (dev)');
  5076. if ($package->getSuggests()) {
  5077. $io->write("\n<info>suggests</info>");
  5078. foreach ($package->getSuggests() as $suggested => $reason) {
  5079. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  5080. }
  5081. }
  5082. $this->printLinks($package, 'provides');
  5083. $this->printLinks($package, 'conflicts');
  5084. $this->printLinks($package, 'replaces');
  5085. }
  5086. return $exitCode;
  5087. }
  5088. if ($input->getOption('tree')) {
  5089. if ('json' === $format) {
  5090. $io->writeError('Format "json" is only supported for package listings, falling back to format "text"');
  5091. }
  5092. $rootRequires = $this->getRootRequires();
  5093. $packages = $installedRepo->getPackages();
  5094. usort($packages, 'strcmp');
  5095. foreach ($packages as $package) {
  5096. if (in_array($package->getName(), $rootRequires, true)) {
  5097. $this->displayPackageTree($package, $installedRepo, $repos);
  5098. }
  5099. }
  5100. return 0;
  5101. }
  5102. if ($repos instanceof CompositeRepository) {
  5103. $repos = $repos->getRepositories();
  5104. } elseif (!is_array($repos)) {
  5105. $repos = array($repos);
  5106. }
  5107. $packages = array();
  5108. if (null !== $packageFilter) {
  5109. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5110. }
  5111. $packageListFilter = array();
  5112. if ($input->getOption('direct')) {
  5113. $packageListFilter = $this->getRootRequires();
  5114. }
  5115. if (class_exists('Symfony\Component\Console\Terminal')) {
  5116. $terminal = new Terminal();
  5117. $width = $terminal->getWidth();
  5118. } else {
  5119. list($width) = $this->getApplication()->getTerminalDimensions();
  5120. }
  5121. if (null === $width) {
  5122. $width = PHP_INT_MAX;
  5123. }
  5124. if (Platform::isWindows()) {
  5125. $width--;
  5126. } else {
  5127. $width = max(80, $width);
  5128. }
  5129. if ($input->getOption('path') && null === $composer) {
  5130. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5131. $input->setOption('path', false);
  5132. }
  5133. foreach ($repos as $repo) {
  5134. if ($repo === $platformRepo) {
  5135. $type = 'platform';
  5136. } elseif (
  5137. $repo === $installedRepo
  5138. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5139. ) {
  5140. $type = 'installed';
  5141. } else {
  5142. $type = 'available';
  5143. }
  5144. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5145. foreach ($repo->getProviderNames() as $name) {
  5146. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5147. $packages[$type][$name] = $name;
  5148. }
  5149. }
  5150. } else {
  5151. foreach ($repo->getPackages() as $package) {
  5152. if (!isset($packages[$type][$package->getName()])
  5153. || !is_object($packages[$type][$package->getName()])
  5154. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5155. ) {
  5156. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5157. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5158. $packages[$type][$package->getName()] = $package;
  5159. }
  5160. }
  5161. }
  5162. }
  5163. }
  5164. }
  5165. $showAllTypes = $input->getOption('all');
  5166. $showLatest = $input->getOption('latest');
  5167. $showMinorOnly = $input->getOption('minor-only');
  5168. $indent = $showAllTypes ? ' ' : '';
  5169. $latestPackages = array();
  5170. $exitCode = 0;
  5171. $viewData = array();
  5172. $viewMetaData = array();
  5173. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5174. if (isset($packages[$type])) {
  5175. ksort($packages[$type]);
  5176. $nameLength = $versionLength = $latestLength = 0;
  5177. foreach ($packages[$type] as $package) {
  5178. if (is_object($package)) {
  5179. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5180. if ($showVersion) {
  5181. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5182. if ($showLatest) {
  5183. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5184. if ($latestPackage === false) {
  5185. continue;
  5186. }
  5187. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5188. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5189. }
  5190. }
  5191. } else {
  5192. $nameLength = max($nameLength, strlen($package));
  5193. }
  5194. }
  5195. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5196. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5197. $writeLatest = $writeVersion && $showLatest;
  5198. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5199. $hasOutdatedPackages = false;
  5200. $viewData[$type] = array();
  5201. $viewMetaData[$type] = array(
  5202. 'nameLength' => $nameLength,
  5203. 'versionLength' => $versionLength,
  5204. 'latestLength' => $latestLength,
  5205. );
  5206. foreach ($packages[$type] as $package) {
  5207. $packageViewData = array();
  5208. if (is_object($package)) {
  5209. $latestPackage = null;
  5210. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5211. $latestPackage = $latestPackages[$package->getPrettyName()];
  5212. }
  5213. if ($input->getOption('outdated') && $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5214. continue;
  5215. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5216. $hasOutdatedPackages = true;
  5217. }
  5218. $packageViewData['name'] = $package->getPrettyName();
  5219. if ($writeVersion) {
  5220. $packageViewData['version'] = $package->getFullPrettyVersion();
  5221. }
  5222. if ($writeLatest && $latestPackage) {
  5223. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5224. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5225. }
  5226. if ($writeDescription) {
  5227. $packageViewData['description'] = $package->getDescription();
  5228. }
  5229. if ($writePath) {
  5230. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5231. }
  5232. if ($latestPackage && $latestPackage->isAbandoned()) {
  5233. $replacement = (is_string($latestPackage->getReplacementPackage()))
  5234. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5235. : 'No replacement was suggested';
  5236. $packageWarning = sprintf(
  5237. 'Package %s is abandoned, you should avoid using it. %s.',
  5238. $package->getPrettyName(),
  5239. $replacement
  5240. );
  5241. $packageViewData['warning'] = $packageWarning;
  5242. }
  5243. } else {
  5244. $packageViewData['name'] = $package;
  5245. }
  5246. $viewData[$type][] = $packageViewData;
  5247. }
  5248. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5249. $exitCode = 1;
  5250. break;
  5251. }
  5252. }
  5253. }
  5254. if ('json' === $format) {
  5255. $io->write(JsonFile::encode($viewData));
  5256. } else {
  5257. foreach ($viewData as $type => $packages) {
  5258. $nameLength = $viewMetaData[$type]['nameLength'];
  5259. $versionLength = $viewMetaData[$type]['versionLength'];
  5260. $latestLength = $viewMetaData[$type]['latestLength'];
  5261. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5262. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5263. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  5264. if ($writeLatest && !$io->isDecorated()) {
  5265. $latestLength += 2;
  5266. }
  5267. if ($showAllTypes) {
  5268. if ('available' === $type) {
  5269. $io->write('<comment>' . $type . '</comment>:');
  5270. } else {
  5271. $io->write('<info>' . $type . '</info>:');
  5272. }
  5273. }
  5274. foreach ($packages as $package) {
  5275. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  5276. if (isset($package['version']) && $writeVersion) {
  5277. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  5278. }
  5279. if (isset($package['latest']) && $writeLatest) {
  5280. $latestVersion = $package['latest'];
  5281. $updateStatus = $package['latest-status'];
  5282. $style = $this->updateStatusToVersionStyle($updateStatus);
  5283. if (!$io->isDecorated()) {
  5284. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  5285. }
  5286. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  5287. }
  5288. if (isset($package['description']) && $writeDescription) {
  5289. $description = strtok($package['description'], "\r\n");
  5290. $remaining = $width - $nameLength - $versionLength - 4;
  5291. if ($writeLatest) {
  5292. $remaining -= $latestLength;
  5293. }
  5294. if (strlen($description) > $remaining) {
  5295. $description = substr($description, 0, $remaining - 3) . '...';
  5296. }
  5297. $io->write(' ' . $description, false);
  5298. }
  5299. if (isset($package['path'])) {
  5300. $io->write(' ' . $package['path'], false);
  5301. }
  5302. $io->write('');
  5303. if (isset($package['warning'])) {
  5304. $io->write('<warning>' . $package['warning'] . '</warning>');
  5305. }
  5306. }
  5307. if ($showAllTypes) {
  5308. $io->write('');
  5309. }
  5310. }
  5311. }
  5312. return $exitCode;
  5313. }
  5314. protected function getRootRequires()
  5315. {
  5316. $rootPackage = $this->getComposer()->getPackage();
  5317. return array_map(
  5318. 'strtolower',
  5319. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  5320. );
  5321. }
  5322. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  5323. {
  5324. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  5325. }
  5326. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  5327. {
  5328. $name = strtolower($name);
  5329. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  5330. $policy = new DefaultPolicy();
  5331. $pool = new Pool('dev');
  5332. $pool->addRepository($repos);
  5333. $matchedPackage = null;
  5334. $versions = array();
  5335. $matches = $pool->whatProvides($name, $constraint);
  5336. foreach ($matches as $index => $package) {
  5337. if ($package->getName() !== $name) {
  5338. unset($matches[$index]);
  5339. continue;
  5340. }
  5341. if (null === $version && $installedRepo->hasPackage($package)) {
  5342. $matchedPackage = $package;
  5343. }
  5344. $versions[$package->getPrettyVersion()] = $package->getVersion();
  5345. $matches[$index] = $package->getId();
  5346. }
  5347. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  5348. $matchedPackage = $pool->literalToPackage($preferred[0]);
  5349. }
  5350. return array($matchedPackage, $versions);
  5351. }
  5352. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  5353. {
  5354. $io = $this->getIO();
  5355. $io->write('<info>name</info> : ' . $package->getPrettyName());
  5356. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  5357. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  5358. $this->printVersions($package, $versions, $installedRepo);
  5359. if ($latestPackage) {
  5360. $style = $this->getVersionStyle($latestPackage, $package);
  5361. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  5362. } else {
  5363. $latestPackage = $package;
  5364. }
  5365. $io->write('<info>type</info> : ' . $package->getType());
  5366. $this->printLicenses($package);
  5367. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  5368. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  5369. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  5370. if ($latestPackage->isAbandoned()) {
  5371. $replacement = ($latestPackage->getReplacementPackage() !== null)
  5372. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  5373. : null;
  5374. $io->writeError(
  5375. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  5376. );
  5377. }
  5378. if ($package->getSupport()) {
  5379. $io->write("\n<info>support</info>");
  5380. foreach ($package->getSupport() as $type => $value) {
  5381. $io->write('<comment>' . $type . '</comment> : '.$value);
  5382. }
  5383. }
  5384. if ($package->getAutoload()) {
  5385. $io->write("\n<info>autoload</info>");
  5386. foreach ($package->getAutoload() as $type => $autoloads) {
  5387. $io->write('<comment>' . $type . '</comment>');
  5388. if ($type === 'psr-0') {
  5389. foreach ($autoloads as $name => $path) {
  5390. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5391. }
  5392. } elseif ($type === 'psr-4') {
  5393. foreach ($autoloads as $name => $path) {
  5394. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5395. }
  5396. } elseif ($type === 'classmap') {
  5397. $io->write(implode(', ', $autoloads));
  5398. }
  5399. }
  5400. if ($package->getIncludePaths()) {
  5401. $io->write('<comment>include-path</comment>');
  5402. $io->write(implode(', ', $package->getIncludePaths()));
  5403. }
  5404. }
  5405. }
  5406. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  5407. {
  5408. uasort($versions, 'version_compare');
  5409. $versions = array_keys(array_reverse($versions));
  5410. if ($installedRepo->hasPackage($package)) {
  5411. $installedVersion = $package->getPrettyVersion();
  5412. $key = array_search($installedVersion, $versions);
  5413. if (false !== $key) {
  5414. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  5415. }
  5416. }
  5417. $versions = implode(', ', $versions);
  5418. $this->getIO()->write('<info>versions</info> : ' . $versions);
  5419. }
  5420. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  5421. {
  5422. $title = $title ?: $linkType;
  5423. $io = $this->getIO();
  5424. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  5425. $io->write("\n<info>" . $title . "</info>");
  5426. foreach ($links as $link) {
  5427. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  5428. }
  5429. }
  5430. }
  5431. protected function printLicenses(CompletePackageInterface $package)
  5432. {
  5433. $spdxLicenses = new SpdxLicenses();
  5434. $licenses = $package->getLicense();
  5435. $io = $this->getIO();
  5436. foreach ($licenses as $licenseId) {
  5437. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  5438. if (!$license) {
  5439. $out = $licenseId;
  5440. } else {
  5441. if ($license[1] === true) {
  5442. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  5443. } else {
  5444. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  5445. }
  5446. }
  5447. $io->write('<info>license</info> : ' . $out);
  5448. }
  5449. }
  5450. protected function initStyles(OutputInterface $output)
  5451. {
  5452. $this->colors = array(
  5453. 'green',
  5454. 'yellow',
  5455. 'cyan',
  5456. 'magenta',
  5457. 'blue',
  5458. );
  5459. foreach ($this->colors as $color) {
  5460. $style = new OutputFormatterStyle($color);
  5461. $output->getFormatter()->setStyle($color, $style);
  5462. }
  5463. }
  5464. protected function displayPackageTree(PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos)
  5465. {
  5466. $io = $this->getIO();
  5467. $io->write(sprintf('<info>%s</info>', $package->getPrettyName()), false);
  5468. $io->write(' ' . $package->getPrettyVersion(), false);
  5469. $io->write(' ' . strtok($package->getDescription(), "\r\n"));
  5470. if (is_object($package)) {
  5471. $requires = $package->getRequires();
  5472. ksort($requires);
  5473. $treeBar = '├';
  5474. $j = 0;
  5475. $total = count($requires);
  5476. foreach ($requires as $requireName => $require) {
  5477. $j++;
  5478. if ($j == 0) {
  5479. $this->writeTreeLine($treeBar);
  5480. }
  5481. if ($j == $total) {
  5482. $treeBar = 'â””';
  5483. }
  5484. $level = 1;
  5485. $color = $this->colors[$level];
  5486. $info = sprintf('%s──<%s>%s</%s> %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint());
  5487. $this->writeTreeLine($info);
  5488. $treeBar = str_replace('â””', ' ', $treeBar);
  5489. $packagesInTree = array($package->getName(), $requireName);
  5490. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree, $treeBar, $level + 1);
  5491. }
  5492. }
  5493. }
  5494. protected function displayTree($name, $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos, array $packagesInTree, $previousTreeBar = '├', $level = 1)
  5495. {
  5496. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5497. list($package, $versions) = $this->getPackage($installedRepo, $distantRepos, $name, $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint());
  5498. if (is_object($package)) {
  5499. $requires = $package->getRequires();
  5500. ksort($requires);
  5501. $treeBar = $previousTreeBar . ' ├';
  5502. $i = 0;
  5503. $total = count($requires);
  5504. foreach ($requires as $requireName => $require) {
  5505. $currentTree = $packagesInTree;
  5506. $i++;
  5507. if ($i == $total) {
  5508. $treeBar = $previousTreeBar . ' â””';
  5509. }
  5510. $colorIdent = $level % count($this->colors);
  5511. $color = $this->colors[$colorIdent];
  5512. $circularWarn = in_array($requireName, $currentTree) ? '(circular dependency aborted here)' : '';
  5513. $info = rtrim(sprintf('%s──<%s>%s</%s> %s %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint(), $circularWarn));
  5514. $this->writeTreeLine($info);
  5515. $treeBar = str_replace('â””', ' ', $treeBar);
  5516. if (!in_array($requireName, $currentTree)) {
  5517. $currentTree[] = $requireName;
  5518. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $currentTree, $treeBar, $level + 1);
  5519. }
  5520. }
  5521. }
  5522. }
  5523. private function updateStatusToVersionStyle($updateStatus)
  5524. {
  5525. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  5526. }
  5527. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  5528. {
  5529. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  5530. return 'up-to-date';
  5531. }
  5532. $constraint = $package->getVersion();
  5533. if (0 !== strpos($constraint, 'dev-')) {
  5534. $constraint = '^'.$constraint;
  5535. }
  5536. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  5537. return 'semver-safe-update';
  5538. }
  5539. return 'update-possible';
  5540. }
  5541. private function writeTreeLine($line)
  5542. {
  5543. $io = $this->getIO();
  5544. if (!$io->isDecorated()) {
  5545. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  5546. }
  5547. $io->write($line);
  5548. }
  5549. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  5550. {
  5551. $name = $package->getName();
  5552. $versionSelector = new VersionSelector($this->getPool($composer));
  5553. $stability = $composer->getPackage()->getMinimumStability();
  5554. $flags = $composer->getPackage()->getStabilityFlags();
  5555. if (isset($flags[$name])) {
  5556. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  5557. }
  5558. $bestStability = $stability;
  5559. if ($composer->getPackage()->getPreferStable()) {
  5560. $bestStability = $package->getStability();
  5561. }
  5562. $targetVersion = null;
  5563. if (0 === strpos($package->getVersion(), 'dev-')) {
  5564. $targetVersion = $package->getVersion();
  5565. }
  5566. if ($targetVersion === null && $minorOnly) {
  5567. $targetVersion = '^' . $package->getVersion();
  5568. }
  5569. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  5570. }
  5571. private function getPool(Composer $composer)
  5572. {
  5573. if (!$this->pool) {
  5574. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  5575. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  5576. }
  5577. return $this->pool;
  5578. }
  5579. }
  5580. <?php
  5581. namespace Composer\Command;
  5582. use Symfony\Component\Console\Input\InputInterface;
  5583. use Symfony\Component\Console\Input\InputOption;
  5584. use Symfony\Component\Console\Output\OutputInterface;
  5585. use Composer\Downloader\ChangeReportInterface;
  5586. use Composer\Downloader\DvcsDownloaderInterface;
  5587. use Composer\Downloader\VcsCapableDownloaderInterface;
  5588. use Composer\Package\Dumper\ArrayDumper;
  5589. use Composer\Package\Version\VersionGuesser;
  5590. use Composer\Package\Version\VersionParser;
  5591. use Composer\Plugin\CommandEvent;
  5592. use Composer\Plugin\PluginEvents;
  5593. use Composer\Script\ScriptEvents;
  5594. use Composer\Util\ProcessExecutor;
  5595. class StatusCommand extends BaseCommand
  5596. {
  5597. const EXIT_CODE_ERRORS = 1;
  5598. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  5599. const EXIT_CODE_VERSION_CHANGES = 4;
  5600. protected function configure()
  5601. {
  5602. $this
  5603. ->setName('status')
  5604. ->setDescription('Shows a list of locally modified packages.')
  5605. ->setDefinition(array(
  5606. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  5607. ))
  5608. ->setHelp(<<<EOT
  5609. The status command displays a list of dependencies that have
  5610. been modified locally.
  5611. EOT
  5612. )
  5613. ;
  5614. }
  5615. protected function execute(InputInterface $input, OutputInterface $output)
  5616. {
  5617. $composer = $this->getComposer();
  5618. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  5619. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5620. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  5621. $dm = $composer->getDownloadManager();
  5622. $im = $composer->getInstallationManager();
  5623. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  5624. $errors = array();
  5625. $io = $this->getIO();
  5626. $unpushedChanges = array();
  5627. $vcsVersionChanges = array();
  5628. $parser = new VersionParser;
  5629. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  5630. $dumper = new ArrayDumper;
  5631. foreach ($installedRepo->getCanonicalPackages() as $package) {
  5632. $downloader = $dm->getDownloaderForInstalledPackage($package);
  5633. $targetDir = $im->getInstallPath($package);
  5634. if ($downloader instanceof ChangeReportInterface) {
  5635. if (is_link($targetDir)) {
  5636. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  5637. }
  5638. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  5639. $errors[$targetDir] = $changes;
  5640. }
  5641. }
  5642. if ($downloader instanceof VcsCapableDownloaderInterface) {
  5643. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  5644. switch ($package->getInstallationSource()) {
  5645. case 'source':
  5646. $previousRef = $package->getSourceReference();
  5647. break;
  5648. case 'dist':
  5649. $previousRef = $package->getDistReference();
  5650. break;
  5651. default:
  5652. $previousRef = null;
  5653. }
  5654. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  5655. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  5656. $vcsVersionChanges[$targetDir] = array(
  5657. 'previous' => array(
  5658. 'version' => $package->getPrettyVersion(),
  5659. 'ref' => $previousRef,
  5660. ),
  5661. 'current' => array(
  5662. 'version' => $currentVersion['pretty_version'],
  5663. 'ref' => $currentVersion['commit'],
  5664. ),
  5665. );
  5666. }
  5667. }
  5668. }
  5669. if ($downloader instanceof DvcsDownloaderInterface) {
  5670. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  5671. $unpushedChanges[$targetDir] = $unpushed;
  5672. }
  5673. }
  5674. }
  5675. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  5676. $io->writeError('<info>No local changes</info>');
  5677. return 0;
  5678. }
  5679. if ($errors) {
  5680. $io->writeError('<error>You have changes in the following dependencies:</error>');
  5681. foreach ($errors as $path => $changes) {
  5682. if ($input->getOption('verbose')) {
  5683. $indentedChanges = implode("\n", array_map(function ($line) {
  5684. return ' ' . ltrim($line);
  5685. }, explode("\n", $changes)));
  5686. $io->write('<info>'.$path.'</info>:');
  5687. $io->write($indentedChanges);
  5688. } else {
  5689. $io->write($path);
  5690. }
  5691. }
  5692. }
  5693. if ($unpushedChanges) {
  5694. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  5695. foreach ($unpushedChanges as $path => $changes) {
  5696. if ($input->getOption('verbose')) {
  5697. $indentedChanges = implode("\n", array_map(function ($line) {
  5698. return ' ' . ltrim($line);
  5699. }, explode("\n", $changes)));
  5700. $io->write('<info>'.$path.'</info>:');
  5701. $io->write($indentedChanges);
  5702. } else {
  5703. $io->write($path);
  5704. }
  5705. }
  5706. }
  5707. if ($vcsVersionChanges) {
  5708. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  5709. foreach ($vcsVersionChanges as $path => $changes) {
  5710. if ($input->getOption('verbose')) {
  5711. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  5712. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  5713. if ($io->isVeryVerbose()) {
  5714. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  5715. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  5716. }
  5717. $io->write('<info>'.$path.'</info>:');
  5718. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  5719. } else {
  5720. $io->write($path);
  5721. }
  5722. }
  5723. }
  5724. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  5725. $io->writeError('Use --verbose (-v) to see a list of files');
  5726. }
  5727. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  5728. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  5729. }
  5730. }
  5731. <?php
  5732. namespace Composer\Command;
  5733. use Composer\Repository\PlatformRepository;
  5734. use Symfony\Component\Console\Input\InputArgument;
  5735. use Symfony\Component\Console\Input\InputInterface;
  5736. use Symfony\Component\Console\Input\InputOption;
  5737. use Symfony\Component\Console\Output\OutputInterface;
  5738. class SuggestsCommand extends BaseCommand
  5739. {
  5740. protected function configure()
  5741. {
  5742. $this
  5743. ->setName('suggests')
  5744. ->setDescription('Shows package suggestions.')
  5745. ->setDefinition(array(
  5746. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  5747. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  5748. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  5749. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  5750. ))
  5751. ->setHelp(<<<EOT
  5752. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  5753. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  5754. EOT
  5755. )
  5756. ;
  5757. }
  5758. protected function execute(InputInterface $input, OutputInterface $output)
  5759. {
  5760. $lock = $this->getComposer()->getLocker()->getLockData();
  5761. if (empty($lock)) {
  5762. throw new \RuntimeException('Lockfile seems to be empty?');
  5763. }
  5764. $packages = $lock['packages'];
  5765. if (!$input->getOption('no-dev')) {
  5766. $packages += $lock['packages-dev'];
  5767. }
  5768. $filter = $input->getArgument('packages');
  5769. $installed = array();
  5770. foreach ($packages as $package) {
  5771. $installed[] = $package['name'];
  5772. if (!empty($package['provide'])) {
  5773. $installed = array_merge($installed, array_keys($package['provide']));
  5774. }
  5775. if (!empty($package['replace'])) {
  5776. $installed = array_merge($installed, array_keys($package['replace']));
  5777. }
  5778. }
  5779. $installed = array_flip($installed);
  5780. ksort($installed);
  5781. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  5782. $suggesters = array();
  5783. $suggested = array();
  5784. foreach ($packages as $package) {
  5785. $packageName = $package['name'];
  5786. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  5787. continue;
  5788. }
  5789. foreach ($package['suggest'] as $suggestion => $reason) {
  5790. if (false === strpos('/', $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  5791. continue;
  5792. }
  5793. if (!isset($installed[$suggestion])) {
  5794. $suggesters[$packageName][$suggestion] = $reason;
  5795. $suggested[$suggestion][$packageName] = $reason;
  5796. }
  5797. }
  5798. }
  5799. ksort($suggesters);
  5800. ksort($suggested);
  5801. $mode = 0;
  5802. $io = $this->getIO();
  5803. if ($input->getOption('by-package') || $io->isVerbose()) {
  5804. $mode |= 1;
  5805. }
  5806. if ($input->getOption('by-suggestion')) {
  5807. $mode |= 2;
  5808. }
  5809. if ($mode === 0) {
  5810. foreach (array_keys($suggested) as $suggestion) {
  5811. $io->write(sprintf('<info>%s</info>', $suggestion));
  5812. }
  5813. return;
  5814. }
  5815. if ($mode & 1) {
  5816. foreach ($suggesters as $suggester => $suggestions) {
  5817. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  5818. foreach ($suggestions as $suggestion => $reason) {
  5819. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  5820. }
  5821. $io->write('');
  5822. }
  5823. }
  5824. if ($mode & 2) {
  5825. if ($mode & 1) {
  5826. $io->write(str_repeat('-', 78));
  5827. }
  5828. foreach ($suggested as $suggestion => $suggesters) {
  5829. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  5830. foreach ($suggesters as $suggester => $reason) {
  5831. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  5832. }
  5833. $io->write('');
  5834. }
  5835. }
  5836. }
  5837. }
  5838. <?php
  5839. namespace Composer\Command;
  5840. use Composer\Composer;
  5841. use Composer\Installer;
  5842. use Composer\IO\IOInterface;
  5843. use Composer\Plugin\CommandEvent;
  5844. use Composer\Plugin\PluginEvents;
  5845. use Symfony\Component\Console\Helper\Table;
  5846. use Symfony\Component\Console\Input\InputInterface;
  5847. use Symfony\Component\Console\Input\InputOption;
  5848. use Symfony\Component\Console\Input\InputArgument;
  5849. use Symfony\Component\Console\Output\OutputInterface;
  5850. use Symfony\Component\Console\Question\Question;
  5851. class UpdateCommand extends BaseCommand
  5852. {
  5853. protected function configure()
  5854. {
  5855. $this
  5856. ->setName('update')
  5857. ->setAliases(array('upgrade'))
  5858. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  5859. ->setDefinition(array(
  5860. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  5861. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  5862. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  5863. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  5864. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  5865. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  5866. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  5867. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  5868. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  5869. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  5870. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5871. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  5872. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of whitelisted packages to the whitelist, except those defined in root package.'),
  5873. 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.'),
  5874. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  5875. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  5876. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  5877. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  5878. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  5879. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  5880. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  5881. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  5882. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  5883. ))
  5884. ->setHelp(<<<EOT
  5885. The <info>update</info> command reads the composer.json file from the
  5886. current directory, processes it, and updates, removes or installs all the
  5887. dependencies.
  5888. <info>php composer.phar update</info>
  5889. To limit the update operation to a few packages, you can list the package(s)
  5890. you want to update as such:
  5891. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  5892. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  5893. from a specific vendor:
  5894. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  5895. To select packages names interactively with auto-completion use <info>-i</info>.
  5896. EOT
  5897. )
  5898. ;
  5899. }
  5900. protected function execute(InputInterface $input, OutputInterface $output)
  5901. {
  5902. $io = $this->getIO();
  5903. if ($input->getOption('no-custom-installers')) {
  5904. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  5905. $input->setOption('no-plugins', true);
  5906. }
  5907. if ($input->getOption('dev')) {
  5908. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  5909. }
  5910. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  5911. $packages = $input->getArgument('packages');
  5912. if ($input->getOption('interactive')) {
  5913. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  5914. }
  5915. if ($input->getOption('root-reqs')) {
  5916. $require = array_keys($composer->getPackage()->getRequires());
  5917. if (!$input->getOption('no-dev')) {
  5918. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  5919. $require = array_merge($require, $requireDev);
  5920. }
  5921. if (!empty($packages)) {
  5922. $packages = array_intersect($packages, $require);
  5923. } else {
  5924. $packages = $require;
  5925. }
  5926. }
  5927. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  5928. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  5929. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5930. $install = Installer::create($io, $composer);
  5931. $config = $composer->getConfig();
  5932. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  5933. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  5934. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  5935. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  5936. $install
  5937. ->setDryRun($input->getOption('dry-run'))
  5938. ->setVerbose($input->getOption('verbose'))
  5939. ->setPreferSource($preferSource)
  5940. ->setPreferDist($preferDist)
  5941. ->setDevMode(!$input->getOption('no-dev'))
  5942. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  5943. ->setRunScripts(!$input->getOption('no-scripts'))
  5944. ->setSkipSuggest($input->getOption('no-suggest'))
  5945. ->setOptimizeAutoloader($optimize)
  5946. ->setClassMapAuthoritative($authoritative)
  5947. ->setApcuAutoloader($apcu)
  5948. ->setUpdate(true)
  5949. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  5950. ->setWhitelistTransitiveDependencies($input->getOption('with-dependencies'))
  5951. ->setWhitelistAllDependencies($input->getOption('with-all-dependencies'))
  5952. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  5953. ->setPreferStable($input->getOption('prefer-stable'))
  5954. ->setPreferLowest($input->getOption('prefer-lowest'))
  5955. ;
  5956. if ($input->getOption('no-plugins')) {
  5957. $install->disablePlugins();
  5958. }
  5959. return $install->run();
  5960. }
  5961. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  5962. {
  5963. if (!$input->isInteractive()) {
  5964. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  5965. }
  5966. $requires = array_merge(
  5967. $composer->getPackage()->getRequires(),
  5968. $composer->getPackage()->getDevRequires()
  5969. );
  5970. $autocompleterValues = array();
  5971. foreach ($requires as $require) {
  5972. $target = $require->getTarget();
  5973. $autocompleterValues[strtolower($target)] = $target;
  5974. }
  5975. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  5976. foreach ($installedPackages as $package) {
  5977. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  5978. }
  5979. $helper = $this->getHelper('question');
  5980. $question = new Question('<comment>Enter package name: </comment>', null);
  5981. $io->writeError('<info>Press enter without value to end submission</info>');
  5982. do {
  5983. $autocompleterValues = array_diff($autocompleterValues, $packages);
  5984. $question->setAutocompleterValues($autocompleterValues);
  5985. $addedPackage = $helper->ask($input, $output, $question);
  5986. if (!is_string($addedPackage) || empty($addedPackage)) {
  5987. break;
  5988. }
  5989. $addedPackage = strtolower($addedPackage);
  5990. if (!in_array($addedPackage, $packages)) {
  5991. $packages[] = $addedPackage;
  5992. }
  5993. } while (true);
  5994. $packages = array_filter($packages);
  5995. if (!$packages) {
  5996. throw new \InvalidArgumentException('You must enter minimum one package.');
  5997. }
  5998. $table = new Table($output);
  5999. $table->setHeaders(array('Selected packages'));
  6000. foreach ($packages as $package) {
  6001. $table->addRow(array($package));
  6002. }
  6003. $table->render();
  6004. if ($io->askConfirmation(sprintf(
  6005. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  6006. 1 === count($packages) ? '' : 's'
  6007. ), true)) {
  6008. return $packages;
  6009. }
  6010. throw new \RuntimeException('Installation aborted.');
  6011. }
  6012. }
  6013. <?php
  6014. namespace Composer\Command;
  6015. use Composer\Factory;
  6016. use Composer\Package\Loader\ValidatingArrayLoader;
  6017. use Composer\Plugin\CommandEvent;
  6018. use Composer\Plugin\PluginEvents;
  6019. use Composer\Util\ConfigValidator;
  6020. use Symfony\Component\Console\Input\InputArgument;
  6021. use Symfony\Component\Console\Input\InputInterface;
  6022. use Symfony\Component\Console\Input\InputOption;
  6023. use Symfony\Component\Console\Output\OutputInterface;
  6024. class ValidateCommand extends BaseCommand
  6025. {
  6026. protected function configure()
  6027. {
  6028. $this
  6029. ->setName('validate')
  6030. ->setDescription('Validates a composer.json and composer.lock.')
  6031. ->setDefinition(array(
  6032. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not make a complete validation'),
  6033. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  6034. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  6035. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  6036. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  6037. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  6038. ))
  6039. ->setHelp(<<<EOT
  6040. The validate command validates a given composer.json and composer.lock
  6041. Exit codes in case of errors are:
  6042. 1 validation warning(s), only when --strict is given
  6043. 2 validation error(s)
  6044. 3 file unreadable or missing
  6045. EOT
  6046. );
  6047. }
  6048. protected function execute(InputInterface $input, OutputInterface $output)
  6049. {
  6050. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  6051. $io = $this->getIO();
  6052. if (!file_exists($file)) {
  6053. $io->writeError('<error>' . $file . ' not found.</error>');
  6054. return 3;
  6055. }
  6056. if (!is_readable($file)) {
  6057. $io->writeError('<error>' . $file . ' is not readable.</error>');
  6058. return 3;
  6059. }
  6060. $validator = new ConfigValidator($io);
  6061. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  6062. $checkPublish = !$input->getOption('no-check-publish');
  6063. $checkLock = !$input->getOption('no-check-lock');
  6064. $isStrict = $input->getOption('strict');
  6065. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6066. $lockErrors = array();
  6067. $composer = Factory::create($io, $file);
  6068. $locker = $composer->getLocker();
  6069. if ($locker->isLocked() && !$locker->isFresh()) {
  6070. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  6071. }
  6072. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  6073. $exitCode = $errors || ($publishErrors && $checkPublish) || ($lockErrors && $checkLock) ? 2 : ($isStrict && $warnings ? 1 : 0);
  6074. if ($input->getOption('with-dependencies')) {
  6075. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6076. foreach ($localRepo->getPackages() as $package) {
  6077. $path = $composer->getInstallationManager()->getInstallPath($package);
  6078. $file = $path . '/composer.json';
  6079. if (is_dir($path) && file_exists($file)) {
  6080. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6081. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  6082. $depCode = $errors || ($publishErrors && $checkPublish) ? 2 : ($isStrict && $warnings ? 1 : 0);
  6083. $exitCode = max($depCode, $exitCode);
  6084. }
  6085. }
  6086. }
  6087. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  6088. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6089. $exitCode = max($eventCode, $exitCode);
  6090. return $exitCode;
  6091. }
  6092. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  6093. {
  6094. if (!$errors && !$publishErrors && !$warnings) {
  6095. $io->write('<info>' . $name . ' is valid</info>');
  6096. } elseif (!$errors && !$publishErrors) {
  6097. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  6098. if ($printSchemaUrl) {
  6099. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6100. }
  6101. } elseif (!$errors) {
  6102. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  6103. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  6104. if ($printSchemaUrl) {
  6105. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6106. }
  6107. } else {
  6108. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  6109. }
  6110. if ($checkPublish) {
  6111. $errors = array_merge($errors, $publishErrors);
  6112. } else {
  6113. $warnings = array_merge($warnings, $publishErrors);
  6114. }
  6115. if ($checkLock) {
  6116. $errors = array_merge($errors, $lockErrors);
  6117. } else {
  6118. $warnings = array_merge($warnings, $lockErrors);
  6119. }
  6120. $messages = array(
  6121. 'error' => $errors,
  6122. 'warning' => $warnings,
  6123. );
  6124. foreach ($messages as $style => $msgs) {
  6125. foreach ($msgs as $msg) {
  6126. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  6127. }
  6128. }
  6129. }
  6130. }
  6131. <?php
  6132. namespace Composer;
  6133. use Composer\Package\RootPackageInterface;
  6134. use Composer\Package\Locker;
  6135. use Composer\Repository\RepositoryManager;
  6136. use Composer\Installer\InstallationManager;
  6137. use Composer\Plugin\PluginManager;
  6138. use Composer\Downloader\DownloadManager;
  6139. use Composer\EventDispatcher\EventDispatcher;
  6140. use Composer\Autoload\AutoloadGenerator;
  6141. use Composer\Package\Archiver\ArchiveManager;
  6142. class Composer
  6143. {
  6144. const VERSION = '4d8b9be5b6a0bda0a3d24c0a6ff89d7ccb26f715';
  6145. const BRANCH_ALIAS_VERSION = '1.7-dev';
  6146. const RELEASE_DATE = '2018-03-05 22:34:22';
  6147. private $package;
  6148. private $locker;
  6149. private $repositoryManager;
  6150. private $downloadManager;
  6151. private $installationManager;
  6152. private $pluginManager;
  6153. private $config;
  6154. private $eventDispatcher;
  6155. private $autoloadGenerator;
  6156. private $archiveManager;
  6157. public function setPackage(RootPackageInterface $package)
  6158. {
  6159. $this->package = $package;
  6160. }
  6161. public function getPackage()
  6162. {
  6163. return $this->package;
  6164. }
  6165. public function setConfig(Config $config)
  6166. {
  6167. $this->config = $config;
  6168. }
  6169. public function getConfig()
  6170. {
  6171. return $this->config;
  6172. }
  6173. public function setLocker(Locker $locker)
  6174. {
  6175. $this->locker = $locker;
  6176. }
  6177. public function getLocker()
  6178. {
  6179. return $this->locker;
  6180. }
  6181. public function setRepositoryManager(RepositoryManager $manager)
  6182. {
  6183. $this->repositoryManager = $manager;
  6184. }
  6185. public function getRepositoryManager()
  6186. {
  6187. return $this->repositoryManager;
  6188. }
  6189. public function setDownloadManager(DownloadManager $manager)
  6190. {
  6191. $this->downloadManager = $manager;
  6192. }
  6193. public function getDownloadManager()
  6194. {
  6195. return $this->downloadManager;
  6196. }
  6197. public function setArchiveManager(ArchiveManager $manager)
  6198. {
  6199. $this->archiveManager = $manager;
  6200. }
  6201. public function getArchiveManager()
  6202. {
  6203. return $this->archiveManager;
  6204. }
  6205. public function setInstallationManager(InstallationManager $manager)
  6206. {
  6207. $this->installationManager = $manager;
  6208. }
  6209. public function getInstallationManager()
  6210. {
  6211. return $this->installationManager;
  6212. }
  6213. public function setPluginManager(PluginManager $manager)
  6214. {
  6215. $this->pluginManager = $manager;
  6216. }
  6217. public function getPluginManager()
  6218. {
  6219. return $this->pluginManager;
  6220. }
  6221. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  6222. {
  6223. $this->eventDispatcher = $eventDispatcher;
  6224. }
  6225. public function getEventDispatcher()
  6226. {
  6227. return $this->eventDispatcher;
  6228. }
  6229. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  6230. {
  6231. $this->autoloadGenerator = $autoloadGenerator;
  6232. }
  6233. public function getAutoloadGenerator()
  6234. {
  6235. return $this->autoloadGenerator;
  6236. }
  6237. }
  6238. <?php
  6239. namespace Composer;
  6240. use Composer\Config\ConfigSourceInterface;
  6241. use Composer\Downloader\TransportException;
  6242. use Composer\IO\IOInterface;
  6243. use Composer\Util\Platform;
  6244. class Config
  6245. {
  6246. const RELATIVE_PATHS = 1;
  6247. public static $defaultConfig = array(
  6248. 'process-timeout' => 300,
  6249. 'use-include-path' => false,
  6250. 'preferred-install' => 'auto',
  6251. 'notify-on-install' => true,
  6252. 'github-protocols' => array('https', 'ssh', 'git'),
  6253. 'vendor-dir' => 'vendor',
  6254. 'bin-dir' => '{$vendor-dir}/bin',
  6255. 'cache-dir' => '{$home}/cache',
  6256. 'data-dir' => '{$home}',
  6257. 'cache-files-dir' => '{$cache-dir}/files',
  6258. 'cache-repo-dir' => '{$cache-dir}/repo',
  6259. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  6260. 'cache-ttl' => 15552000,
  6261. 'cache-files-ttl' => null,
  6262. 'cache-files-maxsize' => '300MiB',
  6263. 'bin-compat' => 'auto',
  6264. 'discard-changes' => false,
  6265. 'autoloader-suffix' => null,
  6266. 'sort-packages' => false,
  6267. 'optimize-autoloader' => false,
  6268. 'classmap-authoritative' => false,
  6269. 'apcu-autoloader' => false,
  6270. 'prepend-autoloader' => true,
  6271. 'github-domains' => array('github.com'),
  6272. 'bitbucket-expose-hostname' => true,
  6273. 'disable-tls' => false,
  6274. 'secure-http' => true,
  6275. 'cafile' => null,
  6276. 'capath' => null,
  6277. 'github-expose-hostname' => true,
  6278. 'gitlab-domains' => array('gitlab.com'),
  6279. 'store-auths' => 'prompt',
  6280. 'platform' => array(),
  6281. 'archive-format' => 'tar',
  6282. 'archive-dir' => '.',
  6283. 'htaccess-protect' => true,
  6284. );
  6285. public static $defaultRepositories = array(
  6286. 'packagist.org' => array(
  6287. 'type' => 'composer',
  6288. 'url' => 'https?://packagist.org',
  6289. 'allow_ssl_downgrade' => true,
  6290. ),
  6291. );
  6292. private $config;
  6293. private $baseDir;
  6294. private $repositories;
  6295. private $configSource;
  6296. private $authConfigSource;
  6297. private $useEnvironment;
  6298. private $warnedHosts = array();
  6299. public function __construct($useEnvironment = true, $baseDir = null)
  6300. {
  6301. $this->config = static::$defaultConfig;
  6302. $this->repositories = static::$defaultRepositories;
  6303. $this->useEnvironment = (bool) $useEnvironment;
  6304. $this->baseDir = $baseDir;
  6305. }
  6306. public function setConfigSource(ConfigSourceInterface $source)
  6307. {
  6308. $this->configSource = $source;
  6309. }
  6310. public function getConfigSource()
  6311. {
  6312. return $this->configSource;
  6313. }
  6314. public function setAuthConfigSource(ConfigSourceInterface $source)
  6315. {
  6316. $this->authConfigSource = $source;
  6317. }
  6318. public function getAuthConfigSource()
  6319. {
  6320. return $this->authConfigSource;
  6321. }
  6322. public function merge($config)
  6323. {
  6324. if (!empty($config['config']) && is_array($config['config'])) {
  6325. foreach ($config['config'] as $key => $val) {
  6326. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic')) && isset($this->config[$key])) {
  6327. $this->config[$key] = array_merge($this->config[$key], $val);
  6328. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  6329. if (is_array($val) || is_array($this->config[$key])) {
  6330. if (is_string($val)) {
  6331. $val = array('*' => $val);
  6332. }
  6333. if (is_string($this->config[$key])) {
  6334. $this->config[$key] = array('*' => $this->config[$key]);
  6335. }
  6336. $this->config[$key] = array_merge($this->config[$key], $val);
  6337. if (isset($this->config[$key]['*'])) {
  6338. $wildcard = $this->config[$key]['*'];
  6339. unset($this->config[$key]['*']);
  6340. $this->config[$key]['*'] = $wildcard;
  6341. }
  6342. } else {
  6343. $this->config[$key] = $val;
  6344. }
  6345. } else {
  6346. $this->config[$key] = $val;
  6347. }
  6348. }
  6349. }
  6350. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  6351. $this->repositories = array_reverse($this->repositories, true);
  6352. $newRepos = array_reverse($config['repositories'], true);
  6353. foreach ($newRepos as $name => $repository) {
  6354. if (false === $repository) {
  6355. $this->disableRepoByName($name);
  6356. continue;
  6357. }
  6358. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  6359. $this->disableRepoByName(key($repository));
  6360. continue;
  6361. }
  6362. if (is_int($name)) {
  6363. $this->repositories[] = $repository;
  6364. } else {
  6365. if ($name === 'packagist') {
  6366. $this->repositories[$name . '.org'] = $repository;
  6367. } else {
  6368. $this->repositories[$name] = $repository;
  6369. }
  6370. }
  6371. }
  6372. $this->repositories = array_reverse($this->repositories, true);
  6373. }
  6374. }
  6375. public function getRepositories()
  6376. {
  6377. return $this->repositories;
  6378. }
  6379. public function get($key, $flags = 0)
  6380. {
  6381. switch ($key) {
  6382. case 'vendor-dir':
  6383. case 'bin-dir':
  6384. case 'process-timeout':
  6385. case 'data-dir':
  6386. case 'cache-dir':
  6387. case 'cache-files-dir':
  6388. case 'cache-repo-dir':
  6389. case 'cache-vcs-dir':
  6390. case 'cafile':
  6391. case 'capath':
  6392. case 'htaccess-protect':
  6393. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  6394. $val = $this->getComposerEnv($env);
  6395. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  6396. $val = Platform::expandPath($val);
  6397. if (substr($key, -4) !== '-dir') {
  6398. return $val;
  6399. }
  6400. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  6401. case 'cache-ttl':
  6402. return (int) $this->config[$key];
  6403. case 'cache-files-maxsize':
  6404. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  6405. throw new \RuntimeException(
  6406. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  6407. );
  6408. }
  6409. $size = $matches[1];
  6410. if (isset($matches[2])) {
  6411. switch (strtolower($matches[2])) {
  6412. case 'g':
  6413. $size *= 1024;
  6414. case 'm':
  6415. $size *= 1024;
  6416. case 'k':
  6417. $size *= 1024;
  6418. break;
  6419. }
  6420. }
  6421. return $size;
  6422. case 'cache-files-ttl':
  6423. if (isset($this->config[$key])) {
  6424. return (int) $this->config[$key];
  6425. }
  6426. return (int) $this->config['cache-ttl'];
  6427. case 'home':
  6428. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  6429. return rtrim($this->process($val, $flags), '/\\');
  6430. case 'bin-compat':
  6431. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  6432. if (!in_array($value, array('auto', 'full'))) {
  6433. throw new \RuntimeException(
  6434. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  6435. );
  6436. }
  6437. return $value;
  6438. case 'discard-changes':
  6439. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  6440. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  6441. throw new \RuntimeException(
  6442. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  6443. );
  6444. }
  6445. if ('stash' === $env) {
  6446. return 'stash';
  6447. }
  6448. return $env !== 'false' && (bool) $env;
  6449. }
  6450. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  6451. throw new \RuntimeException(
  6452. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  6453. );
  6454. }
  6455. return $this->config[$key];
  6456. case 'github-protocols':
  6457. $protos = $this->config['github-protocols'];
  6458. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  6459. unset($protos[$index]);
  6460. }
  6461. if (reset($protos) === 'http') {
  6462. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  6463. }
  6464. return $protos;
  6465. case 'disable-tls':
  6466. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6467. case 'secure-http':
  6468. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6469. default:
  6470. if (!isset($this->config[$key])) {
  6471. return null;
  6472. }
  6473. return $this->process($this->config[$key], $flags);
  6474. }
  6475. }
  6476. public function all($flags = 0)
  6477. {
  6478. $all = array(
  6479. 'repositories' => $this->getRepositories(),
  6480. );
  6481. foreach (array_keys($this->config) as $key) {
  6482. $all['config'][$key] = $this->get($key, $flags);
  6483. }
  6484. return $all;
  6485. }
  6486. public function raw()
  6487. {
  6488. return array(
  6489. 'repositories' => $this->getRepositories(),
  6490. 'config' => $this->config,
  6491. );
  6492. }
  6493. public function has($key)
  6494. {
  6495. return array_key_exists($key, $this->config);
  6496. }
  6497. private function process($value, $flags)
  6498. {
  6499. $config = $this;
  6500. if (!is_string($value)) {
  6501. return $value;
  6502. }
  6503. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  6504. return $config->get($match[1], $flags);
  6505. }, $value);
  6506. }
  6507. private function realpath($path)
  6508. {
  6509. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  6510. return $path;
  6511. }
  6512. return $this->baseDir . '/' . $path;
  6513. }
  6514. private function getComposerEnv($var)
  6515. {
  6516. if ($this->useEnvironment) {
  6517. return getenv($var);
  6518. }
  6519. return false;
  6520. }
  6521. private function disableRepoByName($name)
  6522. {
  6523. if (isset($this->repositories[$name])) {
  6524. unset($this->repositories[$name]);
  6525. } elseif ($name === 'packagist') {
  6526. unset($this->repositories['packagist.org']);
  6527. }
  6528. }
  6529. public function prohibitUrlByConfig($url, IOInterface $io = null)
  6530. {
  6531. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  6532. return;
  6533. }
  6534. $scheme = parse_url($url, PHP_URL_SCHEME);
  6535. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  6536. if ($this->get('secure-http')) {
  6537. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  6538. } elseif ($io) {
  6539. $host = parse_url($url, PHP_URL_HOST);
  6540. if (!isset($this->warnedHosts[$host])) {
  6541. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  6542. }
  6543. $this->warnedHosts[$host] = true;
  6544. }
  6545. }
  6546. }
  6547. }
  6548. <?php
  6549. namespace Composer\Config;
  6550. interface ConfigSourceInterface
  6551. {
  6552. public function addRepository($name, $config);
  6553. public function removeRepository($name);
  6554. public function addConfigSetting($name, $value);
  6555. public function removeConfigSetting($name);
  6556. public function addProperty($name, $value);
  6557. public function removeProperty($name);
  6558. public function addLink($type, $name, $value);
  6559. public function removeLink($type, $name);
  6560. public function getName();
  6561. }
  6562. <?php
  6563. namespace Composer\Config;
  6564. use Composer\Json\JsonFile;
  6565. use Composer\Json\JsonManipulator;
  6566. use Composer\Util\Silencer;
  6567. class JsonConfigSource implements ConfigSourceInterface
  6568. {
  6569. private $file;
  6570. private $authConfig;
  6571. public function __construct(JsonFile $file, $authConfig = false)
  6572. {
  6573. $this->file = $file;
  6574. $this->authConfig = $authConfig;
  6575. }
  6576. public function getName()
  6577. {
  6578. return $this->file->getPath();
  6579. }
  6580. public function addRepository($name, $config)
  6581. {
  6582. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  6583. if (isset($config['repositories'])) {
  6584. foreach ($config['repositories'] as $index => $val) {
  6585. if ($index === $repo) {
  6586. continue;
  6587. }
  6588. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  6589. unset($config['repositories'][$index]);
  6590. $config['repositories']['packagist.org'] = false;
  6591. break;
  6592. }
  6593. }
  6594. }
  6595. $config['repositories'][$repo] = $repoConfig;
  6596. });
  6597. }
  6598. public function removeRepository($name)
  6599. {
  6600. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  6601. unset($config['repositories'][$repo]);
  6602. });
  6603. }
  6604. public function addConfigSetting($name, $value)
  6605. {
  6606. $authConfig = $this->authConfig;
  6607. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  6608. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6609. list($key, $host) = explode('.', $key, 2);
  6610. if ($authConfig) {
  6611. $config[$key][$host] = $val;
  6612. } else {
  6613. $config['config'][$key][$host] = $val;
  6614. }
  6615. } else {
  6616. $config['config'][$key] = $val;
  6617. }
  6618. });
  6619. }
  6620. public function removeConfigSetting($name)
  6621. {
  6622. $authConfig = $this->authConfig;
  6623. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  6624. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6625. list($key, $host) = explode('.', $key, 2);
  6626. if ($authConfig) {
  6627. unset($config[$key][$host]);
  6628. } else {
  6629. unset($config['config'][$key][$host]);
  6630. }
  6631. } else {
  6632. unset($config['config'][$key]);
  6633. }
  6634. });
  6635. }
  6636. public function addProperty($name, $value)
  6637. {
  6638. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  6639. if (substr($key, 0, 6) === 'extra.') {
  6640. $bits = explode('.', $key);
  6641. $last = array_pop($bits);
  6642. $arr = &$config['extra'];
  6643. foreach ($bits as $bit) {
  6644. if (!isset($arr[$bit])) {
  6645. $arr[$bit] = array();
  6646. }
  6647. $arr = &$arr[$bit];
  6648. }
  6649. $arr[$last] = $val;
  6650. } else {
  6651. $config[$key] = $val;
  6652. }
  6653. });
  6654. }
  6655. public function removeProperty($name)
  6656. {
  6657. $authConfig = $this->authConfig;
  6658. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  6659. if (substr($key, 0, 6) === 'extra.') {
  6660. $bits = explode('.', $key);
  6661. $last = array_pop($bits);
  6662. $arr = &$config['extra'];
  6663. foreach ($bits as $bit) {
  6664. if (!isset($arr[$bit])) {
  6665. return;
  6666. }
  6667. $arr = &$arr[$bit];
  6668. }
  6669. unset($arr[$last]);
  6670. } else {
  6671. unset($config[$key]);
  6672. }
  6673. });
  6674. }
  6675. public function addLink($type, $name, $value)
  6676. {
  6677. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  6678. $config[$type][$name] = $value;
  6679. });
  6680. }
  6681. public function removeLink($type, $name)
  6682. {
  6683. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  6684. unset($config[$type][$name]);
  6685. });
  6686. }
  6687. protected function manipulateJson($method, $args, $fallback)
  6688. {
  6689. $args = func_get_args();
  6690. array_shift($args);
  6691. $fallback = array_pop($args);
  6692. if ($this->file->exists()) {
  6693. if (!is_writable($this->file->getPath())) {
  6694. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  6695. }
  6696. if (!is_readable($this->file->getPath())) {
  6697. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  6698. }
  6699. $contents = file_get_contents($this->file->getPath());
  6700. } elseif ($this->authConfig) {
  6701. $contents = "{\n}\n";
  6702. } else {
  6703. $contents = "{\n \"config\": {\n }\n}\n";
  6704. }
  6705. $manipulator = new JsonManipulator($contents);
  6706. $newFile = !$this->file->exists();
  6707. if ($this->authConfig && $method === 'addConfigSetting') {
  6708. $method = 'addSubNode';
  6709. list($mainNode, $name) = explode('.', $args[0], 2);
  6710. $args = array($mainNode, $name, $args[1]);
  6711. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  6712. $method = 'removeSubNode';
  6713. list($mainNode, $name) = explode('.', $args[0], 2);
  6714. $args = array($mainNode, $name);
  6715. }
  6716. if (call_user_func_array(array($manipulator, $method), $args)) {
  6717. file_put_contents($this->file->getPath(), $manipulator->getContents());
  6718. } else {
  6719. $config = $this->file->read();
  6720. $this->arrayUnshiftRef($args, $config);
  6721. call_user_func_array($fallback, $args);
  6722. $this->file->write($config);
  6723. }
  6724. if ($newFile) {
  6725. Silencer::call('chmod', $this->file->getPath(), 0600);
  6726. }
  6727. }
  6728. private function arrayUnshiftRef(&$array, &$value)
  6729. {
  6730. $return = array_unshift($array, '');
  6731. $array[0] = &$value;
  6732. return $return;
  6733. }
  6734. }
  6735. <?php
  6736. namespace Composer\Console;
  6737. use Composer\Util\Platform;
  6738. use Composer\Util\Silencer;
  6739. use Symfony\Component\Console\Application as BaseApplication;
  6740. use Symfony\Component\Console\Input\InputInterface;
  6741. use Symfony\Component\Console\Input\InputOption;
  6742. use Symfony\Component\Console\Output\OutputInterface;
  6743. use Composer\Command;
  6744. use Composer\Composer;
  6745. use Composer\Factory;
  6746. use Composer\IO\IOInterface;
  6747. use Composer\IO\ConsoleIO;
  6748. use Composer\Json\JsonValidationException;
  6749. use Composer\Util\ErrorHandler;
  6750. use Composer\EventDispatcher\ScriptExecutionException;
  6751. use Composer\Exception\NoSslException;
  6752. class Application extends BaseApplication
  6753. {
  6754. protected $composer;
  6755. protected $io;
  6756. private static $logo = ' ______
  6757. / ____/___ ____ ___ ____ ____ ________ _____
  6758. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  6759. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  6760. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  6761. /_/
  6762. ';
  6763. private $hasPluginCommands = false;
  6764. private $disablePluginsByDefault = false;
  6765. public function __construct()
  6766. {
  6767. static $shutdownRegistered = false;
  6768. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  6769. ini_set('xdebug.show_exception_trace', false);
  6770. ini_set('xdebug.scream', false);
  6771. }
  6772. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  6773. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  6774. }
  6775. if (!$shutdownRegistered) {
  6776. $shutdownRegistered = true;
  6777. register_shutdown_function(function () {
  6778. $lastError = error_get_last();
  6779. if ($lastError && $lastError['message'] &&
  6780. (strpos($lastError['message'], 'Allowed memory') !== false ||
  6781. strpos($lastError['message'], 'exceeded memory') !== false )) {
  6782. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  6783. }
  6784. });
  6785. }
  6786. parent::__construct('Composer', Composer::VERSION);
  6787. }
  6788. public function run(InputInterface $input = null, OutputInterface $output = null)
  6789. {
  6790. if (null === $output) {
  6791. $output = Factory::createOutput();
  6792. }
  6793. return parent::run($input, $output);
  6794. }
  6795. public function doRun(InputInterface $input, OutputInterface $output)
  6796. {
  6797. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  6798. $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
  6799. ErrorHandler::register($io);
  6800. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  6801. $oldWorkingDir = getcwd();
  6802. chdir($newWorkDir);
  6803. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  6804. }
  6805. $commandName = '';
  6806. if ($name = $this->getCommandName($input)) {
  6807. try {
  6808. $commandName = $this->find($name)->getName();
  6809. } catch (\InvalidArgumentException $e) {
  6810. }
  6811. }
  6812. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) {
  6813. $dir = dirname(getcwd());
  6814. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  6815. while (dirname($dir) !== $dir && $dir !== $home) {
  6816. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  6817. 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)) {
  6818. $oldWorkingDir = getcwd();
  6819. chdir($dir);
  6820. }
  6821. break;
  6822. }
  6823. $dir = dirname($dir);
  6824. }
  6825. }
  6826. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  6827. try {
  6828. foreach ($this->getPluginCommands() as $command) {
  6829. if ($this->has($command->getName())) {
  6830. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  6831. } else {
  6832. $this->add($command);
  6833. }
  6834. }
  6835. } catch (NoSslException $e) {
  6836. }
  6837. $this->hasPluginCommands = true;
  6838. }
  6839. $isProxyCommand = false;
  6840. if ($name = $this->getCommandName($input)) {
  6841. try {
  6842. $command = $this->find($name);
  6843. $commandName = $command->getName();
  6844. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  6845. } catch (\InvalidArgumentException $e) {
  6846. }
  6847. }
  6848. if (!$isProxyCommand) {
  6849. $io->writeError(sprintf(
  6850. 'Running %s (%s) with %s on %s',
  6851. Composer::VERSION,
  6852. Composer::RELEASE_DATE,
  6853. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  6854. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  6855. ), true, IOInterface::DEBUG);
  6856. if (PHP_VERSION_ID < 50302) {
  6857. $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>');
  6858. }
  6859. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  6860. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  6861. }
  6862. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  6863. $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']));
  6864. }
  6865. if (getenv('COMPOSER_NO_INTERACTION')) {
  6866. $input->setInteractive(false);
  6867. }
  6868. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
  6869. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  6870. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  6871. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  6872. }
  6873. if ($uid = (int) getenv('SUDO_UID')) {
  6874. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  6875. }
  6876. }
  6877. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  6878. }
  6879. Silencer::call(function () use ($io) {
  6880. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  6881. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  6882. $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()));
  6883. }
  6884. });
  6885. $file = Factory::getComposerFile();
  6886. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  6887. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  6888. foreach ($composer['scripts'] as $script => $dummy) {
  6889. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  6890. if ($this->has($script)) {
  6891. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  6892. } else {
  6893. $description = null;
  6894. if (isset($composer['scripts-descriptions'][$script])) {
  6895. $description = $composer['scripts-descriptions'][$script];
  6896. }
  6897. $this->add(new Command\ScriptAliasCommand($script, $description));
  6898. }
  6899. }
  6900. }
  6901. }
  6902. }
  6903. }
  6904. try {
  6905. if ($input->hasParameterOption('--profile')) {
  6906. $startTime = microtime(true);
  6907. $this->io->enableDebugging($startTime);
  6908. }
  6909. $result = parent::doRun($input, $output);
  6910. if (isset($oldWorkingDir)) {
  6911. chdir($oldWorkingDir);
  6912. }
  6913. if (isset($startTime)) {
  6914. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MB), time: '.round(microtime(true) - $startTime, 2).'s');
  6915. }
  6916. restore_error_handler();
  6917. return $result;
  6918. } catch (ScriptExecutionException $e) {
  6919. return $e->getCode();
  6920. } catch (\Exception $e) {
  6921. $this->hintCommonErrors($e);
  6922. restore_error_handler();
  6923. throw $e;
  6924. }
  6925. }
  6926. private function getNewWorkingDir(InputInterface $input)
  6927. {
  6928. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  6929. if (false !== $workingDir && !is_dir($workingDir)) {
  6930. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  6931. }
  6932. return $workingDir;
  6933. }
  6934. private function hintCommonErrors($exception)
  6935. {
  6936. $io = $this->getIO();
  6937. Silencer::suppress();
  6938. try {
  6939. $composer = $this->getComposer(false, true);
  6940. if ($composer) {
  6941. $config = $composer->getConfig();
  6942. $minSpaceFree = 1024 * 1024;
  6943. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  6944. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  6945. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  6946. ) {
  6947. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  6948. }
  6949. }
  6950. } catch (\Exception $e) {
  6951. }
  6952. Silencer::restore();
  6953. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  6954. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  6955. $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);
  6956. }
  6957. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  6958. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  6959. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  6960. }
  6961. }
  6962. public function getComposer($required = true, $disablePlugins = null)
  6963. {
  6964. if (null === $disablePlugins) {
  6965. $disablePlugins = $this->disablePluginsByDefault;
  6966. }
  6967. if (null === $this->composer) {
  6968. try {
  6969. $this->composer = Factory::create($this->io, null, $disablePlugins);
  6970. } catch (\InvalidArgumentException $e) {
  6971. if ($required) {
  6972. $this->io->writeError($e->getMessage());
  6973. exit(1);
  6974. }
  6975. } catch (JsonValidationException $e) {
  6976. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  6977. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  6978. throw new JsonValidationException($message);
  6979. }
  6980. }
  6981. return $this->composer;
  6982. }
  6983. public function resetComposer()
  6984. {
  6985. $this->composer = null;
  6986. }
  6987. public function getIO()
  6988. {
  6989. return $this->io;
  6990. }
  6991. public function getHelp()
  6992. {
  6993. return self::$logo . parent::getHelp();
  6994. }
  6995. protected function getDefaultCommands()
  6996. {
  6997. $commands = array_merge(parent::getDefaultCommands(), array(
  6998. new Command\AboutCommand(),
  6999. new Command\ConfigCommand(),
  7000. new Command\DependsCommand(),
  7001. new Command\ProhibitsCommand(),
  7002. new Command\InitCommand(),
  7003. new Command\InstallCommand(),
  7004. new Command\CreateProjectCommand(),
  7005. new Command\UpdateCommand(),
  7006. new Command\SearchCommand(),
  7007. new Command\ValidateCommand(),
  7008. new Command\ShowCommand(),
  7009. new Command\SuggestsCommand(),
  7010. new Command\RequireCommand(),
  7011. new Command\DumpAutoloadCommand(),
  7012. new Command\StatusCommand(),
  7013. new Command\ArchiveCommand(),
  7014. new Command\DiagnoseCommand(),
  7015. new Command\RunScriptCommand(),
  7016. new Command\LicensesCommand(),
  7017. new Command\GlobalCommand(),
  7018. new Command\ClearCacheCommand(),
  7019. new Command\RemoveCommand(),
  7020. new Command\HomeCommand(),
  7021. new Command\ExecCommand(),
  7022. new Command\OutdatedCommand(),
  7023. new Command\CheckPlatformReqsCommand(),
  7024. ));
  7025. if ('phar:' === substr(__FILE__, 0, 5)) {
  7026. $commands[] = new Command\SelfUpdateCommand();
  7027. }
  7028. return $commands;
  7029. }
  7030. public function getLongVersion()
  7031. {
  7032. if (Composer::BRANCH_ALIAS_VERSION) {
  7033. return sprintf(
  7034. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  7035. $this->getName(),
  7036. Composer::BRANCH_ALIAS_VERSION,
  7037. $this->getVersion(),
  7038. Composer::RELEASE_DATE
  7039. );
  7040. }
  7041. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  7042. }
  7043. protected function getDefaultInputDefinition()
  7044. {
  7045. $definition = parent::getDefaultInputDefinition();
  7046. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  7047. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  7048. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  7049. return $definition;
  7050. }
  7051. private function getPluginCommands()
  7052. {
  7053. $commands = array();
  7054. $composer = $this->getComposer(false, false);
  7055. if (null === $composer) {
  7056. $composer = Factory::createGlobal($this->io, false);
  7057. }
  7058. if (null !== $composer) {
  7059. $pm = $composer->getPluginManager();
  7060. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  7061. $newCommands = $capability->getCommands();
  7062. if (!is_array($newCommands)) {
  7063. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  7064. }
  7065. foreach ($newCommands as $command) {
  7066. if (!$command instanceof Command\BaseCommand) {
  7067. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  7068. }
  7069. }
  7070. $commands = array_merge($commands, $newCommands);
  7071. }
  7072. }
  7073. return $commands;
  7074. }
  7075. }
  7076. <?php
  7077. namespace Composer\Console;
  7078. use Symfony\Component\Console\Formatter\OutputFormatter;
  7079. class HtmlOutputFormatter extends OutputFormatter
  7080. {
  7081. private static $availableForegroundColors = array(
  7082. 30 => 'black',
  7083. 31 => 'red',
  7084. 32 => 'green',
  7085. 33 => 'yellow',
  7086. 34 => 'blue',
  7087. 35 => 'magenta',
  7088. 36 => 'cyan',
  7089. 37 => 'white',
  7090. );
  7091. private static $availableBackgroundColors = array(
  7092. 40 => 'black',
  7093. 41 => 'red',
  7094. 42 => 'green',
  7095. 43 => 'yellow',
  7096. 44 => 'blue',
  7097. 45 => 'magenta',
  7098. 46 => 'cyan',
  7099. 47 => 'white',
  7100. );
  7101. private static $availableOptions = array(
  7102. 1 => 'bold',
  7103. 4 => 'underscore',
  7104. );
  7105. public function __construct(array $styles = array())
  7106. {
  7107. parent::__construct(true, $styles);
  7108. }
  7109. public function format($message)
  7110. {
  7111. $formatted = parent::format($message);
  7112. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  7113. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  7114. }
  7115. private function formatHtml($matches)
  7116. {
  7117. $out = '<span style="';
  7118. foreach (explode(';', $matches[1]) as $code) {
  7119. if (isset(self::$availableForegroundColors[$code])) {
  7120. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  7121. } elseif (isset(self::$availableBackgroundColors[$code])) {
  7122. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  7123. } elseif (isset(self::$availableOptions[$code])) {
  7124. switch (self::$availableOptions[$code]) {
  7125. case 'bold':
  7126. $out .= 'font-weight:bold;';
  7127. break;
  7128. case 'underscore':
  7129. $out .= 'text-decoration:underline;';
  7130. break;
  7131. }
  7132. }
  7133. }
  7134. return $out.'">'.$matches[2].'</span>';
  7135. }
  7136. }
  7137. <?php
  7138. namespace Composer\DependencyResolver;
  7139. class Decisions implements \Iterator, \Countable
  7140. {
  7141. const DECISION_LITERAL = 0;
  7142. const DECISION_REASON = 1;
  7143. protected $pool;
  7144. protected $decisionMap;
  7145. protected $decisionQueue = array();
  7146. public function __construct($pool)
  7147. {
  7148. $this->pool = $pool;
  7149. $this->decisionMap = array();
  7150. }
  7151. public function decide($literal, $level, $why)
  7152. {
  7153. $this->addDecision($literal, $level);
  7154. $this->decisionQueue[] = array(
  7155. self::DECISION_LITERAL => $literal,
  7156. self::DECISION_REASON => $why,
  7157. );
  7158. }
  7159. public function satisfy($literal)
  7160. {
  7161. $packageId = abs($literal);
  7162. return (
  7163. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  7164. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  7165. );
  7166. }
  7167. public function conflict($literal)
  7168. {
  7169. $packageId = abs($literal);
  7170. return (
  7171. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  7172. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  7173. );
  7174. }
  7175. public function decided($literalOrPackageId)
  7176. {
  7177. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  7178. }
  7179. public function undecided($literalOrPackageId)
  7180. {
  7181. return empty($this->decisionMap[abs($literalOrPackageId)]);
  7182. }
  7183. public function decidedInstall($literalOrPackageId)
  7184. {
  7185. $packageId = abs($literalOrPackageId);
  7186. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  7187. }
  7188. public function decisionLevel($literalOrPackageId)
  7189. {
  7190. $packageId = abs($literalOrPackageId);
  7191. if (isset($this->decisionMap[$packageId])) {
  7192. return abs($this->decisionMap[$packageId]);
  7193. }
  7194. return 0;
  7195. }
  7196. public function decisionRule($literalOrPackageId)
  7197. {
  7198. $packageId = abs($literalOrPackageId);
  7199. foreach ($this->decisionQueue as $i => $decision) {
  7200. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  7201. return $decision[self::DECISION_REASON];
  7202. }
  7203. }
  7204. return null;
  7205. }
  7206. public function atOffset($queueOffset)
  7207. {
  7208. return $this->decisionQueue[$queueOffset];
  7209. }
  7210. public function validOffset($queueOffset)
  7211. {
  7212. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  7213. }
  7214. public function lastReason()
  7215. {
  7216. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  7217. }
  7218. public function lastLiteral()
  7219. {
  7220. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  7221. }
  7222. public function reset()
  7223. {
  7224. while ($decision = array_pop($this->decisionQueue)) {
  7225. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7226. }
  7227. }
  7228. public function resetToOffset($offset)
  7229. {
  7230. while (count($this->decisionQueue) > $offset + 1) {
  7231. $decision = array_pop($this->decisionQueue);
  7232. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7233. }
  7234. }
  7235. public function revertLast()
  7236. {
  7237. $this->decisionMap[abs($this->lastLiteral())] = 0;
  7238. array_pop($this->decisionQueue);
  7239. }
  7240. public function count()
  7241. {
  7242. return count($this->decisionQueue);
  7243. }
  7244. public function rewind()
  7245. {
  7246. end($this->decisionQueue);
  7247. }
  7248. public function current()
  7249. {
  7250. return current($this->decisionQueue);
  7251. }
  7252. public function key()
  7253. {
  7254. return key($this->decisionQueue);
  7255. }
  7256. public function next()
  7257. {
  7258. return prev($this->decisionQueue);
  7259. }
  7260. public function valid()
  7261. {
  7262. return false !== current($this->decisionQueue);
  7263. }
  7264. public function isEmpty()
  7265. {
  7266. return count($this->decisionQueue) === 0;
  7267. }
  7268. protected function addDecision($literal, $level)
  7269. {
  7270. $packageId = abs($literal);
  7271. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  7272. if ($previousDecision != 0) {
  7273. $literalString = $this->pool->literalToString($literal);
  7274. $package = $this->pool->literalToPackage($literal);
  7275. throw new SolverBugException(
  7276. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  7277. );
  7278. }
  7279. if ($literal > 0) {
  7280. $this->decisionMap[$packageId] = $level;
  7281. } else {
  7282. $this->decisionMap[$packageId] = -$level;
  7283. }
  7284. }
  7285. }
  7286. <?php
  7287. namespace Composer\DependencyResolver;
  7288. use Composer\Package\PackageInterface;
  7289. use Composer\Package\AliasPackage;
  7290. use Composer\Package\BasePackage;
  7291. use Composer\Semver\Constraint\Constraint;
  7292. class DefaultPolicy implements PolicyInterface
  7293. {
  7294. private $preferStable;
  7295. private $preferLowest;
  7296. public function __construct($preferStable = false, $preferLowest = false)
  7297. {
  7298. $this->preferStable = $preferStable;
  7299. $this->preferLowest = $preferLowest;
  7300. }
  7301. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  7302. {
  7303. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  7304. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  7305. }
  7306. $constraint = new Constraint($operator, $b->getVersion());
  7307. $version = new Constraint('==', $a->getVersion());
  7308. return $constraint->matchSpecific($version, true);
  7309. }
  7310. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  7311. {
  7312. $packages = array();
  7313. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  7314. if ($candidate !== $package) {
  7315. $packages[] = $candidate;
  7316. }
  7317. }
  7318. return $packages;
  7319. }
  7320. public function getPriority(Pool $pool, PackageInterface $package)
  7321. {
  7322. return $pool->getPriority($package->getRepository());
  7323. }
  7324. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  7325. {
  7326. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  7327. foreach ($packages as &$literals) {
  7328. $policy = $this;
  7329. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7330. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  7331. });
  7332. }
  7333. foreach ($packages as &$literals) {
  7334. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  7335. $literals = $this->pruneToBestVersion($pool, $literals);
  7336. $literals = $this->pruneRemoteAliases($pool, $literals);
  7337. }
  7338. $selected = call_user_func_array('array_merge', $packages);
  7339. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7340. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  7341. });
  7342. return $selected;
  7343. }
  7344. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  7345. {
  7346. $packages = array();
  7347. foreach ($literals as $literal) {
  7348. $packageName = $pool->literalToPackage($literal)->getName();
  7349. if (!isset($packages[$packageName])) {
  7350. $packages[$packageName] = array();
  7351. }
  7352. if (isset($installedMap[abs($literal)])) {
  7353. array_unshift($packages[$packageName], $literal);
  7354. } else {
  7355. $packages[$packageName][] = $literal;
  7356. }
  7357. }
  7358. return $packages;
  7359. }
  7360. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  7361. {
  7362. if ($a->getRepository() === $b->getRepository()) {
  7363. if ($a->getName() === $b->getName()) {
  7364. $aAliased = $a instanceof AliasPackage;
  7365. $bAliased = $b instanceof AliasPackage;
  7366. if ($aAliased && !$bAliased) {
  7367. return -1;
  7368. }
  7369. if (!$aAliased && $bAliased) {
  7370. return 1;
  7371. }
  7372. }
  7373. if (!$ignoreReplace) {
  7374. if ($this->replaces($a, $b)) {
  7375. return 1;
  7376. }
  7377. if ($this->replaces($b, $a)) {
  7378. return -1;
  7379. }
  7380. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  7381. $requiredVendor = substr($requiredPackage, 0, $pos);
  7382. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  7383. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  7384. if ($bIsSameVendor !== $aIsSameVendor) {
  7385. return $aIsSameVendor ? -1 : 1;
  7386. }
  7387. }
  7388. }
  7389. if ($a->id === $b->id) {
  7390. return 0;
  7391. }
  7392. return ($a->id < $b->id) ? -1 : 1;
  7393. }
  7394. if (isset($installedMap[$a->id])) {
  7395. return -1;
  7396. }
  7397. if (isset($installedMap[$b->id])) {
  7398. return 1;
  7399. }
  7400. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  7401. }
  7402. protected function replaces(PackageInterface $source, PackageInterface $target)
  7403. {
  7404. foreach ($source->getReplaces() as $link) {
  7405. if ($link->getTarget() === $target->getName()
  7406. ) {
  7407. return true;
  7408. }
  7409. }
  7410. return false;
  7411. }
  7412. protected function pruneToBestVersion(Pool $pool, $literals)
  7413. {
  7414. $operator = $this->preferLowest ? '<' : '>';
  7415. $bestLiterals = array($literals[0]);
  7416. $bestPackage = $pool->literalToPackage($literals[0]);
  7417. foreach ($literals as $i => $literal) {
  7418. if (0 === $i) {
  7419. continue;
  7420. }
  7421. $package = $pool->literalToPackage($literal);
  7422. if ($this->versionCompare($package, $bestPackage, $operator)) {
  7423. $bestPackage = $package;
  7424. $bestLiterals = array($literal);
  7425. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  7426. $bestLiterals[] = $literal;
  7427. }
  7428. }
  7429. return $bestLiterals;
  7430. }
  7431. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  7432. {
  7433. $selected = array();
  7434. $priority = null;
  7435. foreach ($literals as $literal) {
  7436. $package = $pool->literalToPackage($literal);
  7437. if (isset($installedMap[$package->id])) {
  7438. $selected[] = $literal;
  7439. continue;
  7440. }
  7441. if (null === $priority) {
  7442. $priority = $this->getPriority($pool, $package);
  7443. }
  7444. if ($this->getPriority($pool, $package) != $priority) {
  7445. break;
  7446. }
  7447. $selected[] = $literal;
  7448. }
  7449. return $selected;
  7450. }
  7451. protected function pruneRemoteAliases(Pool $pool, array $literals)
  7452. {
  7453. $hasLocalAlias = false;
  7454. foreach ($literals as $literal) {
  7455. $package = $pool->literalToPackage($literal);
  7456. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7457. $hasLocalAlias = true;
  7458. break;
  7459. }
  7460. }
  7461. if (!$hasLocalAlias) {
  7462. return $literals;
  7463. }
  7464. $selected = array();
  7465. foreach ($literals as $literal) {
  7466. $package = $pool->literalToPackage($literal);
  7467. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7468. $selected[] = $literal;
  7469. }
  7470. }
  7471. return $selected;
  7472. }
  7473. }
  7474. <?php
  7475. namespace Composer\DependencyResolver;
  7476. use Composer\Package\PackageInterface;
  7477. use Composer\Package\Link;
  7478. class GenericRule extends Rule
  7479. {
  7480. protected $literals;
  7481. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7482. {
  7483. parent::__construct($reason, $reasonData, $job);
  7484. sort($literals);
  7485. $this->literals = $literals;
  7486. }
  7487. public function getLiterals()
  7488. {
  7489. return $this->literals;
  7490. }
  7491. public function getHash()
  7492. {
  7493. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7494. return $data['hash'];
  7495. }
  7496. public function equals(Rule $rule)
  7497. {
  7498. return $this->literals === $rule->getLiterals();
  7499. }
  7500. public function isAssertion()
  7501. {
  7502. return 1 === count($this->literals);
  7503. }
  7504. public function __toString()
  7505. {
  7506. $result = ($this->isDisabled()) ? 'disabled(' : '(';
  7507. foreach ($this->literals as $i => $literal) {
  7508. if ($i != 0) {
  7509. $result .= '|';
  7510. }
  7511. $result .= $literal;
  7512. }
  7513. $result .= ')';
  7514. return $result;
  7515. }
  7516. }
  7517. <?php
  7518. namespace Composer\DependencyResolver\Operation;
  7519. use Composer\Package\PackageInterface;
  7520. class InstallOperation extends SolverOperation
  7521. {
  7522. protected $package;
  7523. public function __construct(PackageInterface $package, $reason = null)
  7524. {
  7525. parent::__construct($reason);
  7526. $this->package = $package;
  7527. }
  7528. public function getPackage()
  7529. {
  7530. return $this->package;
  7531. }
  7532. public function getJobType()
  7533. {
  7534. return 'install';
  7535. }
  7536. public function __toString()
  7537. {
  7538. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7539. }
  7540. }
  7541. <?php
  7542. namespace Composer\DependencyResolver\Operation;
  7543. use Composer\Package\AliasPackage;
  7544. use Composer\Package\PackageInterface;
  7545. class MarkAliasInstalledOperation extends SolverOperation
  7546. {
  7547. protected $package;
  7548. public function __construct(AliasPackage $package, $reason = null)
  7549. {
  7550. parent::__construct($reason);
  7551. $this->package = $package;
  7552. }
  7553. public function getPackage()
  7554. {
  7555. return $this->package;
  7556. }
  7557. public function getJobType()
  7558. {
  7559. return 'markAliasInstalled';
  7560. }
  7561. public function __toString()
  7562. {
  7563. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7564. }
  7565. }
  7566. <?php
  7567. namespace Composer\DependencyResolver\Operation;
  7568. use Composer\Package\AliasPackage;
  7569. use Composer\Package\PackageInterface;
  7570. class MarkAliasUninstalledOperation extends SolverOperation
  7571. {
  7572. protected $package;
  7573. public function __construct(AliasPackage $package, $reason = null)
  7574. {
  7575. parent::__construct($reason);
  7576. $this->package = $package;
  7577. }
  7578. public function getPackage()
  7579. {
  7580. return $this->package;
  7581. }
  7582. public function getJobType()
  7583. {
  7584. return 'markAliasUninstalled';
  7585. }
  7586. public function __toString()
  7587. {
  7588. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7589. }
  7590. }
  7591. <?php
  7592. namespace Composer\DependencyResolver\Operation;
  7593. interface OperationInterface
  7594. {
  7595. public function getJobType();
  7596. public function getReason();
  7597. public function __toString();
  7598. }
  7599. <?php
  7600. namespace Composer\DependencyResolver\Operation;
  7601. use Composer\Package\PackageInterface;
  7602. abstract class SolverOperation implements OperationInterface
  7603. {
  7604. protected $reason;
  7605. public function __construct($reason = null)
  7606. {
  7607. $this->reason = $reason;
  7608. }
  7609. public function getReason()
  7610. {
  7611. return $this->reason;
  7612. }
  7613. protected function formatVersion(PackageInterface $package)
  7614. {
  7615. return $package->getFullPrettyVersion();
  7616. }
  7617. }
  7618. <?php
  7619. namespace Composer\DependencyResolver\Operation;
  7620. use Composer\Package\PackageInterface;
  7621. class UninstallOperation extends SolverOperation
  7622. {
  7623. protected $package;
  7624. public function __construct(PackageInterface $package, $reason = null)
  7625. {
  7626. parent::__construct($reason);
  7627. $this->package = $package;
  7628. }
  7629. public function getPackage()
  7630. {
  7631. return $this->package;
  7632. }
  7633. public function getJobType()
  7634. {
  7635. return 'uninstall';
  7636. }
  7637. public function __toString()
  7638. {
  7639. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7640. }
  7641. }
  7642. <?php
  7643. namespace Composer\DependencyResolver\Operation;
  7644. use Composer\Package\PackageInterface;
  7645. class UpdateOperation extends SolverOperation
  7646. {
  7647. protected $initialPackage;
  7648. protected $targetPackage;
  7649. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  7650. {
  7651. parent::__construct($reason);
  7652. $this->initialPackage = $initial;
  7653. $this->targetPackage = $target;
  7654. }
  7655. public function getInitialPackage()
  7656. {
  7657. return $this->initialPackage;
  7658. }
  7659. public function getTargetPackage()
  7660. {
  7661. return $this->targetPackage;
  7662. }
  7663. public function getJobType()
  7664. {
  7665. return 'update';
  7666. }
  7667. public function __toString()
  7668. {
  7669. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  7670. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  7671. }
  7672. }
  7673. <?php
  7674. namespace Composer\DependencyResolver;
  7675. use Composer\Package\PackageInterface;
  7676. interface PolicyInterface
  7677. {
  7678. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  7679. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  7680. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  7681. }
  7682. <?php
  7683. namespace Composer\DependencyResolver;
  7684. use Composer\Package\BasePackage;
  7685. use Composer\Package\AliasPackage;
  7686. use Composer\Package\Version\VersionParser;
  7687. use Composer\Semver\Constraint\ConstraintInterface;
  7688. use Composer\Semver\Constraint\Constraint;
  7689. use Composer\Semver\Constraint\EmptyConstraint;
  7690. use Composer\Repository\RepositoryInterface;
  7691. use Composer\Repository\CompositeRepository;
  7692. use Composer\Repository\ComposerRepository;
  7693. use Composer\Repository\InstalledRepositoryInterface;
  7694. use Composer\Repository\PlatformRepository;
  7695. use Composer\Package\PackageInterface;
  7696. class Pool implements \Countable
  7697. {
  7698. const MATCH_NAME = -1;
  7699. const MATCH_NONE = 0;
  7700. const MATCH = 1;
  7701. const MATCH_PROVIDE = 2;
  7702. const MATCH_REPLACE = 3;
  7703. const MATCH_FILTERED = 4;
  7704. protected $repositories = array();
  7705. protected $providerRepos = array();
  7706. protected $packages = array();
  7707. protected $packageByName = array();
  7708. protected $packageByExactName = array();
  7709. protected $acceptableStabilities;
  7710. protected $stabilityFlags;
  7711. protected $versionParser;
  7712. protected $providerCache = array();
  7713. protected $filterRequires;
  7714. protected $whitelist = null;
  7715. protected $id = 1;
  7716. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  7717. {
  7718. $this->versionParser = new VersionParser;
  7719. $this->acceptableStabilities = array();
  7720. foreach (BasePackage::$stabilities as $stability => $value) {
  7721. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  7722. $this->acceptableStabilities[$stability] = $value;
  7723. }
  7724. }
  7725. $this->stabilityFlags = $stabilityFlags;
  7726. $this->filterRequires = $filterRequires;
  7727. foreach ($filterRequires as $name => $constraint) {
  7728. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  7729. unset($this->filterRequires[$name]);
  7730. }
  7731. }
  7732. }
  7733. public function setWhitelist($whitelist)
  7734. {
  7735. $this->whitelist = $whitelist;
  7736. $this->providerCache = array();
  7737. }
  7738. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  7739. {
  7740. if ($repo instanceof CompositeRepository) {
  7741. $repos = $repo->getRepositories();
  7742. } else {
  7743. $repos = array($repo);
  7744. }
  7745. foreach ($repos as $repo) {
  7746. $this->repositories[] = $repo;
  7747. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  7748. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  7749. $this->providerRepos[] = $repo;
  7750. $repo->setRootAliases($rootAliases);
  7751. $repo->resetPackageIds();
  7752. } else {
  7753. foreach ($repo->getPackages() as $package) {
  7754. $names = $package->getNames();
  7755. $stability = $package->getStability();
  7756. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  7757. $package->setId($this->id++);
  7758. $this->packages[] = $package;
  7759. $this->packageByExactName[$package->getName()][$package->id] = $package;
  7760. foreach ($names as $provided) {
  7761. $this->packageByName[$provided][] = $package;
  7762. }
  7763. $name = $package->getName();
  7764. if (isset($rootAliases[$name][$package->getVersion()])) {
  7765. $alias = $rootAliases[$name][$package->getVersion()];
  7766. if ($package instanceof AliasPackage) {
  7767. $package = $package->getAliasOf();
  7768. }
  7769. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  7770. $aliasPackage->setRootPackageAlias(true);
  7771. $aliasPackage->setId($this->id++);
  7772. $package->getRepository()->addPackage($aliasPackage);
  7773. $this->packages[] = $aliasPackage;
  7774. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  7775. foreach ($aliasPackage->getNames() as $name) {
  7776. $this->packageByName[$name][] = $aliasPackage;
  7777. }
  7778. }
  7779. }
  7780. }
  7781. }
  7782. }
  7783. }
  7784. public function getPriority(RepositoryInterface $repo)
  7785. {
  7786. $priority = array_search($repo, $this->repositories, true);
  7787. if (false === $priority) {
  7788. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  7789. }
  7790. return -$priority;
  7791. }
  7792. public function packageById($id)
  7793. {
  7794. return $this->packages[$id - 1];
  7795. }
  7796. public function count()
  7797. {
  7798. return count($this->packages);
  7799. }
  7800. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  7801. {
  7802. if ($bypassFilters) {
  7803. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  7804. }
  7805. $key = ((int) $mustMatchName).$constraint;
  7806. if (isset($this->providerCache[$name][$key])) {
  7807. return $this->providerCache[$name][$key];
  7808. }
  7809. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  7810. }
  7811. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  7812. {
  7813. $candidates = array();
  7814. foreach ($this->providerRepos as $repo) {
  7815. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  7816. $candidates[] = $candidate;
  7817. if ($candidate->id < 1) {
  7818. $candidate->setId($this->id++);
  7819. $this->packages[$this->id - 2] = $candidate;
  7820. }
  7821. }
  7822. }
  7823. if ($mustMatchName) {
  7824. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  7825. return $candidate->getName() == $name;
  7826. });
  7827. if (isset($this->packageByExactName[$name])) {
  7828. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  7829. }
  7830. } elseif (isset($this->packageByName[$name])) {
  7831. $candidates = array_merge($candidates, $this->packageByName[$name]);
  7832. }
  7833. $matches = $provideMatches = array();
  7834. $nameMatch = false;
  7835. foreach ($candidates as $candidate) {
  7836. $aliasOfCandidate = null;
  7837. if ($candidate instanceof AliasPackage) {
  7838. $aliasOfCandidate = $candidate->getAliasOf();
  7839. }
  7840. if ($this->whitelist !== null && !$bypassFilters && (
  7841. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  7842. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  7843. )) {
  7844. continue;
  7845. }
  7846. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  7847. case self::MATCH_NONE:
  7848. break;
  7849. case self::MATCH_NAME:
  7850. $nameMatch = true;
  7851. break;
  7852. case self::MATCH:
  7853. $nameMatch = true;
  7854. $matches[] = $candidate;
  7855. break;
  7856. case self::MATCH_PROVIDE:
  7857. $provideMatches[] = $candidate;
  7858. break;
  7859. case self::MATCH_REPLACE:
  7860. $matches[] = $candidate;
  7861. break;
  7862. case self::MATCH_FILTERED:
  7863. break;
  7864. default:
  7865. throw new \UnexpectedValueException('Unexpected match type');
  7866. }
  7867. }
  7868. if ($nameMatch) {
  7869. return $matches;
  7870. }
  7871. return array_merge($matches, $provideMatches);
  7872. }
  7873. public function literalToPackage($literal)
  7874. {
  7875. $packageId = abs($literal);
  7876. return $this->packageById($packageId);
  7877. }
  7878. public function literalToPrettyString($literal, $installedMap)
  7879. {
  7880. $package = $this->literalToPackage($literal);
  7881. if (isset($installedMap[$package->id])) {
  7882. $prefix = ($literal > 0 ? 'keep' : 'remove');
  7883. } else {
  7884. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  7885. }
  7886. return $prefix.' '.$package->getPrettyString();
  7887. }
  7888. public function isPackageAcceptable($name, $stability)
  7889. {
  7890. foreach ((array) $name as $n) {
  7891. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  7892. return true;
  7893. }
  7894. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  7895. return true;
  7896. }
  7897. }
  7898. return false;
  7899. }
  7900. private function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  7901. {
  7902. $candidateName = $candidate->getName();
  7903. $candidateVersion = $candidate->getVersion();
  7904. $isDev = $candidate->getStability() === 'dev';
  7905. $isAlias = $candidate instanceof AliasPackage;
  7906. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  7907. $requireFilter = $this->filterRequires[$name];
  7908. } else {
  7909. $requireFilter = new EmptyConstraint;
  7910. }
  7911. if ($candidateName === $name) {
  7912. $pkgConstraint = new Constraint('==', $candidateVersion);
  7913. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  7914. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  7915. }
  7916. return self::MATCH_NAME;
  7917. }
  7918. $provides = $candidate->getProvides();
  7919. $replaces = $candidate->getReplaces();
  7920. if (isset($replaces[0]) || isset($provides[0])) {
  7921. foreach ($provides as $link) {
  7922. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  7923. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  7924. }
  7925. }
  7926. foreach ($replaces as $link) {
  7927. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  7928. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  7929. }
  7930. }
  7931. return self::MATCH_NONE;
  7932. }
  7933. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  7934. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  7935. }
  7936. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  7937. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  7938. }
  7939. return self::MATCH_NONE;
  7940. }
  7941. }
  7942. <?php
  7943. namespace Composer\DependencyResolver;
  7944. use Composer\Package\CompletePackageInterface;
  7945. class Problem
  7946. {
  7947. protected $reasonSeen;
  7948. protected $reasons = array();
  7949. protected $section = 0;
  7950. protected $pool;
  7951. public function __construct(Pool $pool)
  7952. {
  7953. $this->pool = $pool;
  7954. }
  7955. public function addRule(Rule $rule)
  7956. {
  7957. $this->addReason(spl_object_hash($rule), array(
  7958. 'rule' => $rule,
  7959. 'job' => $rule->getJob(),
  7960. ));
  7961. }
  7962. public function getReasons()
  7963. {
  7964. return $this->reasons;
  7965. }
  7966. public function getPrettyString(array $installedMap = array())
  7967. {
  7968. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  7969. if (count($reasons) === 1) {
  7970. reset($reasons);
  7971. $reason = current($reasons);
  7972. $rule = $reason['rule'];
  7973. $job = $reason['job'];
  7974. if (isset($job['constraint'])) {
  7975. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7976. } else {
  7977. $packages = array();
  7978. }
  7979. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  7980. if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
  7981. $version = phpversion();
  7982. $available = $this->pool->whatProvides($job['packageName']);
  7983. if (count($available)) {
  7984. $firstAvailable = reset($available);
  7985. $version = $firstAvailable->getPrettyVersion();
  7986. $extra = $firstAvailable->getExtra();
  7987. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  7988. $version .= '; ' . $firstAvailable->getDescription();
  7989. }
  7990. }
  7991. $msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
  7992. if (defined('HHVM_VERSION')) {
  7993. return $msg . 'your HHVM version does not satisfy that requirement.';
  7994. }
  7995. if ($job['packageName'] === 'hhvm') {
  7996. return $msg . 'you are running this with PHP and not HHVM.';
  7997. }
  7998. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  7999. }
  8000. if (0 === stripos($job['packageName'], 'ext-')) {
  8001. if (false !== strpos($job['packageName'], ' ')) {
  8002. return "\n - The requested PHP extension ".$job['packageName'].' should be required as '.str_replace(' ', '-', $job['packageName']).'.';
  8003. }
  8004. $ext = substr($job['packageName'], 4);
  8005. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8006. return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  8007. }
  8008. if (0 === stripos($job['packageName'], 'lib-')) {
  8009. if (strtolower($job['packageName']) === 'lib-icu') {
  8010. $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.';
  8011. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error;
  8012. }
  8013. 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.';
  8014. }
  8015. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $job['packageName'])) {
  8016. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $job['packageName']);
  8017. 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.';
  8018. }
  8019. if ($providers = $this->pool->whatProvides($job['packageName'], $job['constraint'], true, true)) {
  8020. 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.';
  8021. }
  8022. if ($providers = $this->pool->whatProvides($job['packageName'], null, true, true)) {
  8023. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  8024. }
  8025. return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';
  8026. }
  8027. }
  8028. $messages = array();
  8029. foreach ($reasons as $reason) {
  8030. $rule = $reason['rule'];
  8031. $job = $reason['job'];
  8032. if ($job) {
  8033. $messages[] = $this->jobToText($job);
  8034. } elseif ($rule) {
  8035. if ($rule instanceof Rule) {
  8036. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  8037. }
  8038. }
  8039. }
  8040. return "\n - ".implode("\n - ", $messages);
  8041. }
  8042. protected function addReason($id, $reason)
  8043. {
  8044. if (!isset($this->reasonSeen[$id])) {
  8045. $this->reasonSeen[$id] = true;
  8046. $this->reasons[$this->section][] = $reason;
  8047. }
  8048. }
  8049. public function nextSection()
  8050. {
  8051. $this->section++;
  8052. }
  8053. protected function jobToText($job)
  8054. {
  8055. switch ($job['cmd']) {
  8056. case 'install':
  8057. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8058. if (!$packages) {
  8059. return 'No package found to satisfy install request for '.$job['packageName'].$this->constraintToText($job['constraint']);
  8060. }
  8061. return 'Installation request for '.$job['packageName'].$this->constraintToText($job['constraint']).' -> satisfiable by '.$this->getPackageList($packages).'.';
  8062. case 'update':
  8063. return 'Update request for '.$job['packageName'].$this->constraintToText($job['constraint']).'.';
  8064. case 'remove':
  8065. return 'Removal request for '.$job['packageName'].$this->constraintToText($job['constraint']).'';
  8066. }
  8067. if (isset($job['constraint'])) {
  8068. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8069. } else {
  8070. $packages = array();
  8071. }
  8072. return 'Job(cmd='.$job['cmd'].', target='.$job['packageName'].', packages=['.$this->getPackageList($packages).'])';
  8073. }
  8074. protected function getPackageList($packages)
  8075. {
  8076. $prepared = array();
  8077. foreach ($packages as $package) {
  8078. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8079. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8080. }
  8081. foreach ($prepared as $name => $package) {
  8082. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8083. }
  8084. return implode(', ', $prepared);
  8085. }
  8086. protected function constraintToText($constraint)
  8087. {
  8088. return ($constraint) ? ' '.$constraint->getPrettyString() : '';
  8089. }
  8090. }
  8091. <?php
  8092. namespace Composer\DependencyResolver;
  8093. use Composer\Semver\Constraint\ConstraintInterface;
  8094. class Request
  8095. {
  8096. protected $jobs;
  8097. public function __construct()
  8098. {
  8099. $this->jobs = array();
  8100. }
  8101. public function install($packageName, ConstraintInterface $constraint = null)
  8102. {
  8103. $this->addJob($packageName, 'install', $constraint);
  8104. }
  8105. public function update($packageName, ConstraintInterface $constraint = null)
  8106. {
  8107. $this->addJob($packageName, 'update', $constraint);
  8108. }
  8109. public function remove($packageName, ConstraintInterface $constraint = null)
  8110. {
  8111. $this->addJob($packageName, 'remove', $constraint);
  8112. }
  8113. public function fix($packageName, ConstraintInterface $constraint = null)
  8114. {
  8115. $this->addJob($packageName, 'install', $constraint, true);
  8116. }
  8117. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  8118. {
  8119. $packageName = strtolower($packageName);
  8120. $this->jobs[] = array(
  8121. 'cmd' => $cmd,
  8122. 'packageName' => $packageName,
  8123. 'constraint' => $constraint,
  8124. 'fixed' => $fixed,
  8125. );
  8126. }
  8127. public function updateAll()
  8128. {
  8129. $this->jobs[] = array('cmd' => 'update-all');
  8130. }
  8131. public function getJobs()
  8132. {
  8133. return $this->jobs;
  8134. }
  8135. }
  8136. <?php
  8137. namespace Composer\DependencyResolver;
  8138. use Composer\Package\CompletePackage;
  8139. use Composer\Package\Link;
  8140. use Composer\Package\PackageInterface;
  8141. abstract class Rule
  8142. {
  8143. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  8144. const RULE_JOB_INSTALL = 2;
  8145. const RULE_JOB_REMOVE = 3;
  8146. const RULE_PACKAGE_CONFLICT = 6;
  8147. const RULE_PACKAGE_REQUIRES = 7;
  8148. const RULE_PACKAGE_OBSOLETES = 8;
  8149. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  8150. const RULE_PACKAGE_SAME_NAME = 10;
  8151. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  8152. const RULE_LEARNED = 12;
  8153. const RULE_PACKAGE_ALIAS = 13;
  8154. const BITFIELD_TYPE = 0;
  8155. const BITFIELD_REASON = 8;
  8156. const BITFIELD_DISABLED = 16;
  8157. protected $bitfield;
  8158. protected $job;
  8159. protected $reasonData;
  8160. public function __construct($reason, $reasonData, $job = null)
  8161. {
  8162. $this->reasonData = $reasonData;
  8163. if ($job) {
  8164. $this->job = $job;
  8165. }
  8166. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  8167. ($reason << self::BITFIELD_REASON) |
  8168. (255 << self::BITFIELD_TYPE);
  8169. }
  8170. abstract public function getLiterals();
  8171. abstract public function getHash();
  8172. public function getJob()
  8173. {
  8174. return isset($this->job) ? $this->job : null;
  8175. }
  8176. abstract public function equals(Rule $rule);
  8177. public function getReason()
  8178. {
  8179. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  8180. }
  8181. public function getReasonData()
  8182. {
  8183. return $this->reasonData;
  8184. }
  8185. public function getRequiredPackage()
  8186. {
  8187. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  8188. return $this->reasonData;
  8189. }
  8190. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  8191. return $this->reasonData->getTarget();
  8192. }
  8193. }
  8194. public function setType($type)
  8195. {
  8196. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  8197. }
  8198. public function getType()
  8199. {
  8200. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  8201. }
  8202. public function disable()
  8203. {
  8204. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  8205. }
  8206. public function enable()
  8207. {
  8208. $this->bitfield = $this->bitfield & ~(255 << self::BITFIELD_DISABLED);
  8209. }
  8210. public function isDisabled()
  8211. {
  8212. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8213. }
  8214. public function isEnabled()
  8215. {
  8216. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8217. }
  8218. abstract public function isAssertion();
  8219. public function getPrettyString(Pool $pool, array $installedMap = array())
  8220. {
  8221. $literals = $this->getLiterals();
  8222. $ruleText = '';
  8223. foreach ($literals as $i => $literal) {
  8224. if ($i != 0) {
  8225. $ruleText .= '|';
  8226. }
  8227. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  8228. }
  8229. switch ($this->getReason()) {
  8230. case self::RULE_INTERNAL_ALLOW_UPDATE:
  8231. return $ruleText;
  8232. case self::RULE_JOB_INSTALL:
  8233. return "Install command rule ($ruleText)";
  8234. case self::RULE_JOB_REMOVE:
  8235. return "Remove command rule ($ruleText)";
  8236. case self::RULE_PACKAGE_CONFLICT:
  8237. $package1 = $pool->literalToPackage($literals[0]);
  8238. $package2 = $pool->literalToPackage($literals[1]);
  8239. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  8240. case self::RULE_PACKAGE_REQUIRES:
  8241. $sourceLiteral = array_shift($literals);
  8242. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  8243. $requires = array();
  8244. foreach ($literals as $literal) {
  8245. $requires[] = $pool->literalToPackage($literal);
  8246. }
  8247. $text = $this->reasonData->getPrettyString($sourcePackage);
  8248. if ($requires) {
  8249. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  8250. } else {
  8251. $targetName = $this->reasonData->getTarget();
  8252. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  8253. if (defined('HHVM_VERSION')) {
  8254. return $text . ' -> your HHVM version does not satisfy that requirement.';
  8255. }
  8256. if ($targetName === 'hhvm') {
  8257. return $text . ' -> you are running this with PHP and not HHVM.';
  8258. }
  8259. $packages = $pool->whatProvides($targetName);
  8260. $package = count($packages) ? current($packages) : phpversion();
  8261. if (!($package instanceof CompletePackage)) {
  8262. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  8263. }
  8264. $extra = $package->getExtra();
  8265. if (!empty($extra['config.platform'])) {
  8266. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8267. } else {
  8268. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8269. }
  8270. return $text;
  8271. }
  8272. if (0 === strpos($targetName, 'ext-')) {
  8273. $ext = substr($targetName, 4);
  8274. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8275. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  8276. }
  8277. if (0 === strpos($targetName, 'lib-')) {
  8278. $lib = substr($targetName, 4);
  8279. 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.';
  8280. }
  8281. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  8282. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  8283. }
  8284. return $text . ' -> no matching package found.';
  8285. }
  8286. return $text;
  8287. case self::RULE_PACKAGE_OBSOLETES:
  8288. return $ruleText;
  8289. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  8290. return $ruleText;
  8291. case self::RULE_PACKAGE_SAME_NAME:
  8292. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  8293. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  8294. return $ruleText;
  8295. case self::RULE_LEARNED:
  8296. return 'Conclusion: '.$ruleText;
  8297. case self::RULE_PACKAGE_ALIAS:
  8298. return $ruleText;
  8299. default:
  8300. return '('.$ruleText.')';
  8301. }
  8302. }
  8303. protected function formatPackagesUnique($pool, array $packages)
  8304. {
  8305. $prepared = array();
  8306. foreach ($packages as $package) {
  8307. if (!is_object($package)) {
  8308. $package = $pool->literalToPackage($package);
  8309. }
  8310. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8311. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8312. }
  8313. foreach ($prepared as $name => $package) {
  8314. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8315. }
  8316. return implode(', ', $prepared);
  8317. }
  8318. }
  8319. <?php
  8320. namespace Composer\DependencyResolver;
  8321. use Composer\Package\PackageInterface;
  8322. use Composer\Package\Link;
  8323. class Rule2Literals extends Rule
  8324. {
  8325. protected $literal1;
  8326. protected $literal2;
  8327. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  8328. {
  8329. parent::__construct($reason, $reasonData, $job);
  8330. if ($literal1 < $literal2) {
  8331. $this->literal1 = $literal1;
  8332. $this->literal2 = $literal2;
  8333. } else {
  8334. $this->literal1 = $literal2;
  8335. $this->literal2 = $literal1;
  8336. }
  8337. }
  8338. public function getLiterals()
  8339. {
  8340. return array($this->literal1, $this->literal2);
  8341. }
  8342. public function getHash()
  8343. {
  8344. $data = unpack('ihash', md5($this->literal1.','.$this->literal2, true));
  8345. return $data['hash'];
  8346. }
  8347. public function equals(Rule $rule)
  8348. {
  8349. $literals = $rule->getLiterals();
  8350. if (2 != count($literals)) {
  8351. return false;
  8352. }
  8353. if ($this->literal1 !== $literals[0]) {
  8354. return false;
  8355. }
  8356. if ($this->literal2 !== $literals[1]) {
  8357. return false;
  8358. }
  8359. return true;
  8360. }
  8361. public function isAssertion()
  8362. {
  8363. return false;
  8364. }
  8365. public function __toString()
  8366. {
  8367. $result = ($this->isDisabled()) ? 'disabled(' : '(';
  8368. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  8369. return $result;
  8370. }
  8371. }
  8372. <?php
  8373. namespace Composer\DependencyResolver;
  8374. class RuleSet implements \IteratorAggregate, \Countable
  8375. {
  8376. const TYPE_PACKAGE = 0;
  8377. const TYPE_JOB = 1;
  8378. const TYPE_LEARNED = 4;
  8379. public $ruleById;
  8380. protected static $types = array(
  8381. 255 => 'UNKNOWN',
  8382. self::TYPE_PACKAGE => 'PACKAGE',
  8383. self::TYPE_JOB => 'JOB',
  8384. self::TYPE_LEARNED => 'LEARNED',
  8385. );
  8386. protected $rules;
  8387. protected $nextRuleId;
  8388. protected $rulesByHash;
  8389. public function __construct()
  8390. {
  8391. $this->nextRuleId = 0;
  8392. foreach ($this->getTypes() as $type) {
  8393. $this->rules[$type] = array();
  8394. }
  8395. $this->rulesByHash = array();
  8396. }
  8397. public function add(Rule $rule, $type)
  8398. {
  8399. if (!isset(self::$types[$type])) {
  8400. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  8401. }
  8402. $hash = $rule->getHash();
  8403. if (isset($this->rulesByHash[$hash])) {
  8404. $potentialDuplicates = $this->rulesByHash[$hash];
  8405. if (is_array($potentialDuplicates)) {
  8406. foreach ($potentialDuplicates as $potentialDuplicate) {
  8407. if ($rule->equals($potentialDuplicate)) {
  8408. return;
  8409. }
  8410. }
  8411. } else {
  8412. if ($rule->equals($potentialDuplicates)) {
  8413. return;
  8414. }
  8415. }
  8416. }
  8417. if (!isset($this->rules[$type])) {
  8418. $this->rules[$type] = array();
  8419. }
  8420. $this->rules[$type][] = $rule;
  8421. $this->ruleById[$this->nextRuleId] = $rule;
  8422. $rule->setType($type);
  8423. $this->nextRuleId++;
  8424. if (!isset($this->rulesByHash[$hash])) {
  8425. $this->rulesByHash[$hash] = $rule;
  8426. } elseif (is_array($this->rulesByHash[$hash])) {
  8427. $this->rulesByHash[$hash][] = $rule;
  8428. } else {
  8429. $originalRule = $this->rulesByHash[$hash];
  8430. $this->rulesByHash[$hash] = array($originalRule, $rule);
  8431. }
  8432. }
  8433. public function count()
  8434. {
  8435. return $this->nextRuleId;
  8436. }
  8437. public function ruleById($id)
  8438. {
  8439. return $this->ruleById[$id];
  8440. }
  8441. public function getRules()
  8442. {
  8443. return $this->rules;
  8444. }
  8445. public function getIterator()
  8446. {
  8447. return new RuleSetIterator($this->getRules());
  8448. }
  8449. public function getIteratorFor($types)
  8450. {
  8451. if (!is_array($types)) {
  8452. $types = array($types);
  8453. }
  8454. $allRules = $this->getRules();
  8455. $rules = array();
  8456. foreach ($types as $type) {
  8457. $rules[$type] = $allRules[$type];
  8458. }
  8459. return new RuleSetIterator($rules);
  8460. }
  8461. public function getIteratorWithout($types)
  8462. {
  8463. if (!is_array($types)) {
  8464. $types = array($types);
  8465. }
  8466. $rules = $this->getRules();
  8467. foreach ($types as $type) {
  8468. unset($rules[$type]);
  8469. }
  8470. return new RuleSetIterator($rules);
  8471. }
  8472. public function getTypes()
  8473. {
  8474. $types = self::$types;
  8475. unset($types[255]);
  8476. return array_keys($types);
  8477. }
  8478. public function getPrettyString(Pool $pool = null)
  8479. {
  8480. $string = "\n";
  8481. foreach ($this->rules as $type => $rules) {
  8482. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  8483. foreach ($rules as $rule) {
  8484. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  8485. }
  8486. $string .= "\n\n";
  8487. }
  8488. return $string;
  8489. }
  8490. public function __toString()
  8491. {
  8492. return $this->getPrettyString(null);
  8493. }
  8494. }
  8495. <?php
  8496. namespace Composer\DependencyResolver;
  8497. use Composer\Package\PackageInterface;
  8498. use Composer\Package\AliasPackage;
  8499. use Composer\Repository\PlatformRepository;
  8500. class RuleSetGenerator
  8501. {
  8502. protected $policy;
  8503. protected $pool;
  8504. protected $rules;
  8505. protected $jobs;
  8506. protected $installedMap;
  8507. protected $whitelistedMap;
  8508. protected $addedMap;
  8509. public function __construct(PolicyInterface $policy, Pool $pool)
  8510. {
  8511. $this->policy = $policy;
  8512. $this->pool = $pool;
  8513. }
  8514. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  8515. {
  8516. $literals = array(-$package->id);
  8517. foreach ($providers as $provider) {
  8518. if ($provider === $package) {
  8519. return null;
  8520. }
  8521. $literals[] = $provider->id;
  8522. }
  8523. return new GenericRule($literals, $reason, $reasonData);
  8524. }
  8525. protected function createInstallOneOfRule(array $packages, $reason, $job)
  8526. {
  8527. $literals = array();
  8528. foreach ($packages as $package) {
  8529. $literals[] = $package->id;
  8530. }
  8531. return new GenericRule($literals, $reason, $job['packageName'], $job);
  8532. }
  8533. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  8534. {
  8535. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  8536. }
  8537. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  8538. {
  8539. if ($issuer === $provider) {
  8540. return null;
  8541. }
  8542. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  8543. }
  8544. private function addRule($type, Rule $newRule = null)
  8545. {
  8546. if (!$newRule) {
  8547. return;
  8548. }
  8549. $this->rules->add($newRule, $type);
  8550. }
  8551. protected function whitelistFromPackage(PackageInterface $package)
  8552. {
  8553. $workQueue = new \SplQueue;
  8554. $workQueue->enqueue($package);
  8555. while (!$workQueue->isEmpty()) {
  8556. $package = $workQueue->dequeue();
  8557. if (isset($this->whitelistedMap[$package->id])) {
  8558. continue;
  8559. }
  8560. $this->whitelistedMap[$package->id] = true;
  8561. foreach ($package->getRequires() as $link) {
  8562. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  8563. foreach ($possibleRequires as $require) {
  8564. $workQueue->enqueue($require);
  8565. }
  8566. }
  8567. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  8568. foreach ($obsoleteProviders as $provider) {
  8569. if ($provider === $package) {
  8570. continue;
  8571. }
  8572. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8573. $workQueue->enqueue($provider);
  8574. }
  8575. }
  8576. }
  8577. }
  8578. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  8579. {
  8580. $workQueue = new \SplQueue;
  8581. $workQueue->enqueue($package);
  8582. while (!$workQueue->isEmpty()) {
  8583. $package = $workQueue->dequeue();
  8584. if (isset($this->addedMap[$package->id])) {
  8585. continue;
  8586. }
  8587. $this->addedMap[$package->id] = true;
  8588. foreach ($package->getRequires() as $link) {
  8589. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  8590. continue;
  8591. }
  8592. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8593. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  8594. foreach ($possibleRequires as $require) {
  8595. $workQueue->enqueue($require);
  8596. }
  8597. }
  8598. foreach ($package->getConflicts() as $link) {
  8599. $possibleConflicts = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8600. foreach ($possibleConflicts as $conflict) {
  8601. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  8602. }
  8603. }
  8604. $isInstalled = (isset($this->installedMap[$package->id]));
  8605. foreach ($package->getReplaces() as $link) {
  8606. $obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8607. foreach ($obsoleteProviders as $provider) {
  8608. if ($provider === $package) {
  8609. continue;
  8610. }
  8611. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8612. $reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  8613. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  8614. }
  8615. }
  8616. }
  8617. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null);
  8618. foreach ($obsoleteProviders as $provider) {
  8619. if ($provider === $package) {
  8620. continue;
  8621. }
  8622. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8623. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  8624. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8625. $reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  8626. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRule2Literals($package, $provider, $reason, $package));
  8627. }
  8628. }
  8629. }
  8630. }
  8631. protected function obsoleteImpossibleForAlias($package, $provider)
  8632. {
  8633. $packageIsAlias = $package instanceof AliasPackage;
  8634. $providerIsAlias = $provider instanceof AliasPackage;
  8635. $impossible = (
  8636. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  8637. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  8638. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  8639. );
  8640. return $impossible;
  8641. }
  8642. protected function whitelistFromJobs()
  8643. {
  8644. foreach ($this->jobs as $job) {
  8645. switch ($job['cmd']) {
  8646. case 'install':
  8647. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  8648. foreach ($packages as $package) {
  8649. $this->whitelistFromPackage($package);
  8650. }
  8651. break;
  8652. }
  8653. }
  8654. }
  8655. protected function addRulesForJobs($ignorePlatformReqs)
  8656. {
  8657. foreach ($this->jobs as $job) {
  8658. switch ($job['cmd']) {
  8659. case 'install':
  8660. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8661. break;
  8662. }
  8663. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8664. if ($packages) {
  8665. foreach ($packages as $package) {
  8666. if (!isset($this->installedMap[$package->id])) {
  8667. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8668. }
  8669. }
  8670. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  8671. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8672. }
  8673. break;
  8674. case 'remove':
  8675. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8676. foreach ($packages as $package) {
  8677. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  8678. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8679. }
  8680. break;
  8681. }
  8682. }
  8683. }
  8684. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  8685. {
  8686. $this->jobs = $jobs;
  8687. $this->rules = new RuleSet;
  8688. $this->installedMap = $installedMap;
  8689. $this->whitelistedMap = array();
  8690. foreach ($this->installedMap as $package) {
  8691. $this->whitelistFromPackage($package);
  8692. }
  8693. $this->whitelistFromJobs();
  8694. $this->pool->setWhitelist($this->whitelistedMap);
  8695. $this->addedMap = array();
  8696. foreach ($this->installedMap as $package) {
  8697. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8698. }
  8699. $this->addRulesForJobs($ignorePlatformReqs);
  8700. return $this->rules;
  8701. }
  8702. }
  8703. <?php
  8704. namespace Composer\DependencyResolver;
  8705. class RuleSetIterator implements \Iterator
  8706. {
  8707. protected $rules;
  8708. protected $types;
  8709. protected $currentOffset;
  8710. protected $currentType;
  8711. protected $currentTypeOffset;
  8712. public function __construct(array $rules)
  8713. {
  8714. $this->rules = $rules;
  8715. $this->types = array_keys($rules);
  8716. sort($this->types);
  8717. $this->rewind();
  8718. }
  8719. public function current()
  8720. {
  8721. return $this->rules[$this->currentType][$this->currentOffset];
  8722. }
  8723. public function key()
  8724. {
  8725. return $this->currentType;
  8726. }
  8727. public function next()
  8728. {
  8729. $this->currentOffset++;
  8730. if (!isset($this->rules[$this->currentType])) {
  8731. return;
  8732. }
  8733. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  8734. $this->currentOffset = 0;
  8735. do {
  8736. $this->currentTypeOffset++;
  8737. if (!isset($this->types[$this->currentTypeOffset])) {
  8738. $this->currentType = -1;
  8739. break;
  8740. }
  8741. $this->currentType = $this->types[$this->currentTypeOffset];
  8742. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  8743. }
  8744. }
  8745. public function rewind()
  8746. {
  8747. $this->currentOffset = 0;
  8748. $this->currentTypeOffset = -1;
  8749. $this->currentType = -1;
  8750. do {
  8751. $this->currentTypeOffset++;
  8752. if (!isset($this->types[$this->currentTypeOffset])) {
  8753. $this->currentType = -1;
  8754. break;
  8755. }
  8756. $this->currentType = $this->types[$this->currentTypeOffset];
  8757. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  8758. }
  8759. public function valid()
  8760. {
  8761. return isset($this->rules[$this->currentType])
  8762. && isset($this->rules[$this->currentType][$this->currentOffset]);
  8763. }
  8764. }
  8765. <?php
  8766. namespace Composer\DependencyResolver;
  8767. class RuleWatchChain extends \SplDoublyLinkedList
  8768. {
  8769. protected $offset = 0;
  8770. public function seek($offset)
  8771. {
  8772. $this->rewind();
  8773. for ($i = 0; $i < $offset; $i++, $this->next());
  8774. }
  8775. public function remove()
  8776. {
  8777. $offset = $this->key();
  8778. $this->offsetUnset($offset);
  8779. $this->seek($offset);
  8780. }
  8781. }
  8782. <?php
  8783. namespace Composer\DependencyResolver;
  8784. class RuleWatchGraph
  8785. {
  8786. protected $watchChains = array();
  8787. public function insert(RuleWatchNode $node)
  8788. {
  8789. if ($node->getRule()->isAssertion()) {
  8790. return;
  8791. }
  8792. foreach (array($node->watch1, $node->watch2) as $literal) {
  8793. if (!isset($this->watchChains[$literal])) {
  8794. $this->watchChains[$literal] = new RuleWatchChain;
  8795. }
  8796. $this->watchChains[$literal]->unshift($node);
  8797. }
  8798. }
  8799. public function propagateLiteral($decidedLiteral, $level, $decisions)
  8800. {
  8801. $literal = -$decidedLiteral;
  8802. if (!isset($this->watchChains[$literal])) {
  8803. return null;
  8804. }
  8805. $chain = $this->watchChains[$literal];
  8806. $chain->rewind();
  8807. while ($chain->valid()) {
  8808. $node = $chain->current();
  8809. $otherWatch = $node->getOtherWatch($literal);
  8810. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  8811. $ruleLiterals = $node->getRule()->getLiterals();
  8812. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  8813. return $literal !== $ruleLiteral &&
  8814. $otherWatch !== $ruleLiteral &&
  8815. !$decisions->conflict($ruleLiteral);
  8816. });
  8817. if ($alternativeLiterals) {
  8818. reset($alternativeLiterals);
  8819. $this->moveWatch($literal, current($alternativeLiterals), $node);
  8820. continue;
  8821. }
  8822. if ($decisions->conflict($otherWatch)) {
  8823. return $node->getRule();
  8824. }
  8825. $decisions->decide($otherWatch, $level, $node->getRule());
  8826. }
  8827. $chain->next();
  8828. }
  8829. return null;
  8830. }
  8831. protected function moveWatch($fromLiteral, $toLiteral, $node)
  8832. {
  8833. if (!isset($this->watchChains[$toLiteral])) {
  8834. $this->watchChains[$toLiteral] = new RuleWatchChain;
  8835. }
  8836. $node->moveWatch($fromLiteral, $toLiteral);
  8837. $this->watchChains[$fromLiteral]->remove();
  8838. $this->watchChains[$toLiteral]->unshift($node);
  8839. }
  8840. }
  8841. <?php
  8842. namespace Composer\DependencyResolver;
  8843. class RuleWatchNode
  8844. {
  8845. public $watch1;
  8846. public $watch2;
  8847. protected $rule;
  8848. public function __construct($rule)
  8849. {
  8850. $this->rule = $rule;
  8851. $literals = $rule->getLiterals();
  8852. $this->watch1 = count($literals) > 0 ? $literals[0] : 0;
  8853. $this->watch2 = count($literals) > 1 ? $literals[1] : 0;
  8854. }
  8855. public function watch2OnHighest(Decisions $decisions)
  8856. {
  8857. $literals = $this->rule->getLiterals();
  8858. if (count($literals) < 3) {
  8859. return;
  8860. }
  8861. $watchLevel = 0;
  8862. foreach ($literals as $literal) {
  8863. $level = $decisions->decisionLevel($literal);
  8864. if ($level > $watchLevel) {
  8865. $this->watch2 = $literal;
  8866. $watchLevel = $level;
  8867. }
  8868. }
  8869. }
  8870. public function getRule()
  8871. {
  8872. return $this->rule;
  8873. }
  8874. public function getOtherWatch($literal)
  8875. {
  8876. if ($this->watch1 == $literal) {
  8877. return $this->watch2;
  8878. }
  8879. return $this->watch1;
  8880. }
  8881. public function moveWatch($from, $to)
  8882. {
  8883. if ($this->watch1 == $from) {
  8884. $this->watch1 = $to;
  8885. } else {
  8886. $this->watch2 = $to;
  8887. }
  8888. }
  8889. }
  8890. <?php
  8891. namespace Composer\DependencyResolver;
  8892. use Composer\IO\IOInterface;
  8893. use Composer\Repository\RepositoryInterface;
  8894. use Composer\Repository\PlatformRepository;
  8895. class Solver
  8896. {
  8897. const BRANCH_LITERALS = 0;
  8898. const BRANCH_LEVEL = 1;
  8899. protected $policy;
  8900. protected $pool;
  8901. protected $installed;
  8902. protected $rules;
  8903. protected $ruleSetGenerator;
  8904. protected $jobs;
  8905. protected $updateMap = array();
  8906. protected $watchGraph;
  8907. protected $decisions;
  8908. protected $installedMap;
  8909. protected $propagateIndex;
  8910. protected $branches = array();
  8911. protected $problems = array();
  8912. protected $learnedPool = array();
  8913. protected $learnedWhy = array();
  8914. protected $io;
  8915. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  8916. {
  8917. $this->io = $io;
  8918. $this->policy = $policy;
  8919. $this->pool = $pool;
  8920. $this->installed = $installed;
  8921. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  8922. }
  8923. public function getRuleSetSize()
  8924. {
  8925. return count($this->rules);
  8926. }
  8927. private function makeAssertionRuleDecisions()
  8928. {
  8929. $decisionStart = count($this->decisions) - 1;
  8930. $rulesCount = count($this->rules);
  8931. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  8932. $rule = $this->rules->ruleById[$ruleIndex];
  8933. if (!$rule->isAssertion() || $rule->isDisabled()) {
  8934. continue;
  8935. }
  8936. $literals = $rule->getLiterals();
  8937. $literal = $literals[0];
  8938. if (!$this->decisions->decided(abs($literal))) {
  8939. $this->decisions->decide($literal, 1, $rule);
  8940. continue;
  8941. }
  8942. if ($this->decisions->satisfy($literal)) {
  8943. continue;
  8944. }
  8945. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  8946. $rule->disable();
  8947. continue;
  8948. }
  8949. $conflict = $this->decisions->decisionRule($literal);
  8950. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  8951. $problem = new Problem($this->pool);
  8952. $problem->addRule($rule);
  8953. $problem->addRule($conflict);
  8954. $this->disableProblem($rule);
  8955. $this->problems[] = $problem;
  8956. continue;
  8957. }
  8958. $problem = new Problem($this->pool);
  8959. $problem->addRule($rule);
  8960. $problem->addRule($conflict);
  8961. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  8962. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  8963. continue;
  8964. }
  8965. $assertRuleLiterals = $assertRule->getLiterals();
  8966. $assertRuleLiteral = $assertRuleLiterals[0];
  8967. if (abs($literal) !== abs($assertRuleLiteral)) {
  8968. continue;
  8969. }
  8970. $problem->addRule($assertRule);
  8971. $this->disableProblem($assertRule);
  8972. }
  8973. $this->problems[] = $problem;
  8974. $this->decisions->resetToOffset($decisionStart);
  8975. $ruleIndex = -1;
  8976. }
  8977. }
  8978. protected function setupInstalledMap()
  8979. {
  8980. $this->installedMap = array();
  8981. foreach ($this->installed->getPackages() as $package) {
  8982. $this->installedMap[$package->id] = $package;
  8983. }
  8984. }
  8985. protected function checkForRootRequireProblems($ignorePlatformReqs)
  8986. {
  8987. foreach ($this->jobs as $job) {
  8988. switch ($job['cmd']) {
  8989. case 'update':
  8990. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8991. foreach ($packages as $package) {
  8992. if (isset($this->installedMap[$package->id])) {
  8993. $this->updateMap[$package->id] = true;
  8994. }
  8995. }
  8996. break;
  8997. case 'update-all':
  8998. foreach ($this->installedMap as $package) {
  8999. $this->updateMap[$package->id] = true;
  9000. }
  9001. break;
  9002. case 'install':
  9003. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9004. break;
  9005. }
  9006. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  9007. $problem = new Problem($this->pool);
  9008. $problem->addRule(new GenericRule(array(), null, null, $job));
  9009. $this->problems[] = $problem;
  9010. }
  9011. break;
  9012. }
  9013. }
  9014. }
  9015. public function solve(Request $request, $ignorePlatformReqs = false)
  9016. {
  9017. $this->jobs = $request->getJobs();
  9018. $this->setupInstalledMap();
  9019. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  9020. $this->checkForRootRequireProblems($ignorePlatformReqs);
  9021. $this->decisions = new Decisions($this->pool);
  9022. $this->watchGraph = new RuleWatchGraph;
  9023. foreach ($this->rules as $rule) {
  9024. $this->watchGraph->insert(new RuleWatchNode($rule));
  9025. }
  9026. $this->makeAssertionRuleDecisions();
  9027. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  9028. $before = microtime(true);
  9029. $this->runSat(true);
  9030. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  9031. foreach ($this->installedMap as $packageId => $void) {
  9032. if ($this->decisions->undecided($packageId)) {
  9033. $this->decisions->decide(-$packageId, 1, null);
  9034. }
  9035. }
  9036. if ($this->problems) {
  9037. throw new SolverProblemsException($this->problems, $this->installedMap);
  9038. }
  9039. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  9040. return $transaction->getOperations();
  9041. }
  9042. protected function propagate($level)
  9043. {
  9044. while ($this->decisions->validOffset($this->propagateIndex)) {
  9045. $decision = $this->decisions->atOffset($this->propagateIndex);
  9046. $conflict = $this->watchGraph->propagateLiteral(
  9047. $decision[Decisions::DECISION_LITERAL],
  9048. $level,
  9049. $this->decisions
  9050. );
  9051. $this->propagateIndex++;
  9052. if ($conflict) {
  9053. return $conflict;
  9054. }
  9055. }
  9056. return null;
  9057. }
  9058. private function revert($level)
  9059. {
  9060. while (!$this->decisions->isEmpty()) {
  9061. $literal = $this->decisions->lastLiteral();
  9062. if ($this->decisions->undecided($literal)) {
  9063. break;
  9064. }
  9065. $decisionLevel = $this->decisions->decisionLevel($literal);
  9066. if ($decisionLevel <= $level) {
  9067. break;
  9068. }
  9069. $this->decisions->revertLast();
  9070. $this->propagateIndex = count($this->decisions);
  9071. }
  9072. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  9073. array_pop($this->branches);
  9074. }
  9075. }
  9076. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  9077. {
  9078. $level++;
  9079. $this->decisions->decide($literal, $level, $rule);
  9080. while (true) {
  9081. $rule = $this->propagate($level);
  9082. if (!$rule) {
  9083. break;
  9084. }
  9085. if ($level == 1) {
  9086. return $this->analyzeUnsolvable($rule, $disableRules);
  9087. }
  9088. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  9089. if ($newLevel <= 0 || $newLevel >= $level) {
  9090. throw new SolverBugException(
  9091. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  9092. );
  9093. } elseif (!$newRule) {
  9094. throw new SolverBugException(
  9095. "No rule was learned from analyzing $rule at level $level."
  9096. );
  9097. }
  9098. $level = $newLevel;
  9099. $this->revert($level);
  9100. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  9101. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  9102. $ruleNode = new RuleWatchNode($newRule);
  9103. $ruleNode->watch2OnHighest($this->decisions);
  9104. $this->watchGraph->insert($ruleNode);
  9105. $this->decisions->decide($learnLiteral, $level, $newRule);
  9106. }
  9107. return $level;
  9108. }
  9109. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  9110. {
  9111. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  9112. $selectedLiteral = array_shift($literals);
  9113. if (count($literals)) {
  9114. $this->branches[] = array($literals, $level);
  9115. }
  9116. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  9117. }
  9118. protected function analyze($level, Rule $rule)
  9119. {
  9120. $analyzedRule = $rule;
  9121. $ruleLevel = 1;
  9122. $num = 0;
  9123. $l1num = 0;
  9124. $seen = array();
  9125. $learnedLiterals = array(null);
  9126. $decisionId = count($this->decisions);
  9127. $this->learnedPool[] = array();
  9128. while (true) {
  9129. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  9130. foreach ($rule->getLiterals() as $literal) {
  9131. if ($this->decisions->satisfy($literal)) {
  9132. continue;
  9133. }
  9134. if (isset($seen[abs($literal)])) {
  9135. continue;
  9136. }
  9137. $seen[abs($literal)] = true;
  9138. $l = $this->decisions->decisionLevel($literal);
  9139. if (1 === $l) {
  9140. $l1num++;
  9141. } elseif ($level === $l) {
  9142. $num++;
  9143. } else {
  9144. $learnedLiterals[] = $literal;
  9145. if ($l > $ruleLevel) {
  9146. $ruleLevel = $l;
  9147. }
  9148. }
  9149. }
  9150. $l1retry = true;
  9151. while ($l1retry) {
  9152. $l1retry = false;
  9153. if (!$num && !--$l1num) {
  9154. break 2;
  9155. }
  9156. while (true) {
  9157. if ($decisionId <= 0) {
  9158. throw new SolverBugException(
  9159. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  9160. );
  9161. }
  9162. $decisionId--;
  9163. $decision = $this->decisions->atOffset($decisionId);
  9164. $literal = $decision[Decisions::DECISION_LITERAL];
  9165. if (isset($seen[abs($literal)])) {
  9166. break;
  9167. }
  9168. }
  9169. unset($seen[abs($literal)]);
  9170. if ($num && 0 === --$num) {
  9171. $learnedLiterals[0] = -abs($literal);
  9172. if (!$l1num) {
  9173. break 2;
  9174. }
  9175. foreach ($learnedLiterals as $i => $learnedLiteral) {
  9176. if ($i !== 0) {
  9177. unset($seen[abs($learnedLiteral)]);
  9178. }
  9179. }
  9180. $l1num++;
  9181. $l1retry = true;
  9182. }
  9183. }
  9184. $decision = $this->decisions->atOffset($decisionId);
  9185. $rule = $decision[Decisions::DECISION_REASON];
  9186. }
  9187. $why = count($this->learnedPool) - 1;
  9188. if (!$learnedLiterals[0]) {
  9189. throw new SolverBugException(
  9190. "Did not find a learnable literal in analyzed rule $analyzedRule."
  9191. );
  9192. }
  9193. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  9194. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  9195. }
  9196. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  9197. {
  9198. $why = spl_object_hash($conflictRule);
  9199. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  9200. $learnedWhy = $this->learnedWhy[$why];
  9201. $problemRules = $this->learnedPool[$learnedWhy];
  9202. foreach ($problemRules as $problemRule) {
  9203. $this->analyzeUnsolvableRule($problem, $problemRule);
  9204. }
  9205. return;
  9206. }
  9207. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  9208. return;
  9209. }
  9210. $problem->nextSection();
  9211. $problem->addRule($conflictRule);
  9212. }
  9213. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  9214. {
  9215. $problem = new Problem($this->pool);
  9216. $problem->addRule($conflictRule);
  9217. $this->analyzeUnsolvableRule($problem, $conflictRule);
  9218. $this->problems[] = $problem;
  9219. $seen = array();
  9220. $literals = $conflictRule->getLiterals();
  9221. foreach ($literals as $literal) {
  9222. if ($this->decisions->satisfy($literal)) {
  9223. continue;
  9224. }
  9225. $seen[abs($literal)] = true;
  9226. }
  9227. foreach ($this->decisions as $decision) {
  9228. $literal = $decision[Decisions::DECISION_LITERAL];
  9229. if (!isset($seen[abs($literal)])) {
  9230. continue;
  9231. }
  9232. $why = $decision[Decisions::DECISION_REASON];
  9233. $problem->addRule($why);
  9234. $this->analyzeUnsolvableRule($problem, $why);
  9235. $literals = $why->getLiterals();
  9236. foreach ($literals as $literal) {
  9237. if ($this->decisions->satisfy($literal)) {
  9238. continue;
  9239. }
  9240. $seen[abs($literal)] = true;
  9241. }
  9242. }
  9243. if ($disableRules) {
  9244. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  9245. $this->disableProblem($reason['rule']);
  9246. }
  9247. $this->resetSolver();
  9248. return 1;
  9249. }
  9250. return 0;
  9251. }
  9252. private function disableProblem(Rule $why)
  9253. {
  9254. $job = $why->getJob();
  9255. if (!$job) {
  9256. $why->disable();
  9257. return;
  9258. }
  9259. foreach ($this->rules as $rule) {
  9260. if ($job === $rule->getJob()) {
  9261. $rule->disable();
  9262. }
  9263. }
  9264. }
  9265. private function resetSolver()
  9266. {
  9267. $this->decisions->reset();
  9268. $this->propagateIndex = 0;
  9269. $this->branches = array();
  9270. $this->enableDisableLearnedRules();
  9271. $this->makeAssertionRuleDecisions();
  9272. }
  9273. private function enableDisableLearnedRules()
  9274. {
  9275. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  9276. $why = $this->learnedWhy[spl_object_hash($rule)];
  9277. $problemRules = $this->learnedPool[$why];
  9278. $foundDisabled = false;
  9279. foreach ($problemRules as $problemRule) {
  9280. if ($problemRule->isDisabled()) {
  9281. $foundDisabled = true;
  9282. break;
  9283. }
  9284. }
  9285. if ($foundDisabled && $rule->isEnabled()) {
  9286. $rule->disable();
  9287. } elseif (!$foundDisabled && $rule->isDisabled()) {
  9288. $rule->enable();
  9289. }
  9290. }
  9291. }
  9292. private function runSat($disableRules = true)
  9293. {
  9294. $this->propagateIndex = 0;
  9295. $decisionQueue = array();
  9296. $decisionSupplementQueue = array();
  9297. $disableRules = array();
  9298. $level = 1;
  9299. $systemLevel = $level + 1;
  9300. $installedPos = 0;
  9301. while (true) {
  9302. if (1 === $level) {
  9303. $conflictRule = $this->propagate($level);
  9304. if (null !== $conflictRule) {
  9305. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  9306. continue;
  9307. }
  9308. return;
  9309. }
  9310. }
  9311. if ($level < $systemLevel) {
  9312. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  9313. foreach ($iterator as $rule) {
  9314. if ($rule->isEnabled()) {
  9315. $decisionQueue = array();
  9316. $noneSatisfied = true;
  9317. foreach ($rule->getLiterals() as $literal) {
  9318. if ($this->decisions->satisfy($literal)) {
  9319. $noneSatisfied = false;
  9320. break;
  9321. }
  9322. if ($literal > 0 && $this->decisions->undecided($literal)) {
  9323. $decisionQueue[] = $literal;
  9324. }
  9325. }
  9326. if ($noneSatisfied && count($decisionQueue)) {
  9327. if (count($this->installed) != count($this->updateMap)) {
  9328. $prunedQueue = array();
  9329. foreach ($decisionQueue as $literal) {
  9330. if (isset($this->installedMap[abs($literal)])) {
  9331. $prunedQueue[] = $literal;
  9332. if (isset($this->updateMap[abs($literal)])) {
  9333. $prunedQueue = $decisionQueue;
  9334. break;
  9335. }
  9336. }
  9337. }
  9338. $decisionQueue = $prunedQueue;
  9339. }
  9340. }
  9341. if ($noneSatisfied && count($decisionQueue)) {
  9342. $oLevel = $level;
  9343. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9344. if (0 === $level) {
  9345. return;
  9346. }
  9347. if ($level <= $oLevel) {
  9348. break;
  9349. }
  9350. }
  9351. }
  9352. }
  9353. $systemLevel = $level + 1;
  9354. $iterator->next();
  9355. if ($iterator->valid()) {
  9356. continue;
  9357. }
  9358. }
  9359. if ($level < $systemLevel) {
  9360. $systemLevel = $level;
  9361. }
  9362. $rulesCount = count($this->rules);
  9363. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  9364. if ($i == $rulesCount) {
  9365. $i = 0;
  9366. }
  9367. $rule = $this->rules->ruleById[$i];
  9368. $literals = $rule->getLiterals();
  9369. if ($rule->isDisabled()) {
  9370. continue;
  9371. }
  9372. $decisionQueue = array();
  9373. foreach ($literals as $literal) {
  9374. if ($literal <= 0) {
  9375. if (!$this->decisions->decidedInstall(abs($literal))) {
  9376. continue 2;
  9377. }
  9378. } else {
  9379. if ($this->decisions->decidedInstall(abs($literal))) {
  9380. continue 2;
  9381. }
  9382. if ($this->decisions->undecided(abs($literal))) {
  9383. $decisionQueue[] = $literal;
  9384. }
  9385. }
  9386. }
  9387. if (count($decisionQueue) < 2) {
  9388. continue;
  9389. }
  9390. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9391. if (0 === $level) {
  9392. return;
  9393. }
  9394. $rulesCount = count($this->rules);
  9395. $n = -1;
  9396. }
  9397. if ($level < $systemLevel) {
  9398. continue;
  9399. }
  9400. if (count($this->branches)) {
  9401. $lastLiteral = null;
  9402. $lastLevel = null;
  9403. $lastBranchIndex = 0;
  9404. $lastBranchOffset = 0;
  9405. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  9406. list($literals, $l) = $this->branches[$i];
  9407. foreach ($literals as $offset => $literal) {
  9408. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  9409. $lastLiteral = $literal;
  9410. $lastBranchIndex = $i;
  9411. $lastBranchOffset = $offset;
  9412. $lastLevel = $l;
  9413. }
  9414. }
  9415. }
  9416. if ($lastLiteral) {
  9417. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  9418. $level = $lastLevel;
  9419. $this->revert($level);
  9420. $why = $this->decisions->lastReason();
  9421. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  9422. if ($level == 0) {
  9423. return;
  9424. }
  9425. continue;
  9426. }
  9427. }
  9428. break;
  9429. }
  9430. }
  9431. }
  9432. <?php
  9433. namespace Composer\DependencyResolver;
  9434. class SolverBugException extends \RuntimeException
  9435. {
  9436. public function __construct($message)
  9437. {
  9438. parent::__construct(
  9439. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  9440. "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");
  9441. }
  9442. }
  9443. <?php
  9444. namespace Composer\DependencyResolver;
  9445. use Composer\Util\IniHelper;
  9446. class SolverProblemsException extends \RuntimeException
  9447. {
  9448. protected $problems;
  9449. protected $installedMap;
  9450. public function __construct(array $problems, array $installedMap)
  9451. {
  9452. $this->problems = $problems;
  9453. $this->installedMap = $installedMap;
  9454. parent::__construct($this->createMessage(), 2);
  9455. }
  9456. protected function createMessage()
  9457. {
  9458. $text = "\n";
  9459. $hasExtensionProblems = false;
  9460. foreach ($this->problems as $i => $problem) {
  9461. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  9462. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  9463. $hasExtensionProblems = true;
  9464. }
  9465. }
  9466. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  9467. $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.";
  9468. }
  9469. if ($hasExtensionProblems) {
  9470. $text .= $this->createExtensionHint();
  9471. }
  9472. return $text;
  9473. }
  9474. public function getProblems()
  9475. {
  9476. return $this->problems;
  9477. }
  9478. private function createExtensionHint()
  9479. {
  9480. $paths = IniHelper::getAll();
  9481. if (count($paths) === 1 && empty($paths[0])) {
  9482. return '';
  9483. }
  9484. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  9485. $text .= implode("\n - ", $paths);
  9486. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  9487. return $text;
  9488. }
  9489. private function hasExtensionProblems(array $reasonSets)
  9490. {
  9491. foreach ($reasonSets as $reasonSet) {
  9492. foreach ($reasonSet as $reason) {
  9493. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  9494. return true;
  9495. }
  9496. }
  9497. }
  9498. return false;
  9499. }
  9500. }
  9501. <?php
  9502. namespace Composer\DependencyResolver;
  9503. use Composer\Package\AliasPackage;
  9504. class Transaction
  9505. {
  9506. protected $policy;
  9507. protected $pool;
  9508. protected $installedMap;
  9509. protected $decisions;
  9510. protected $transaction;
  9511. public function __construct($policy, $pool, $installedMap, $decisions)
  9512. {
  9513. $this->policy = $policy;
  9514. $this->pool = $pool;
  9515. $this->installedMap = $installedMap;
  9516. $this->decisions = $decisions;
  9517. $this->transaction = array();
  9518. }
  9519. public function getOperations()
  9520. {
  9521. $installMeansUpdateMap = $this->findUpdates();
  9522. $updateMap = array();
  9523. $installMap = array();
  9524. $uninstallMap = array();
  9525. foreach ($this->decisions as $i => $decision) {
  9526. $literal = $decision[Decisions::DECISION_LITERAL];
  9527. $reason = $decision[Decisions::DECISION_REASON];
  9528. $package = $this->pool->literalToPackage($literal);
  9529. if (($literal > 0) == (isset($this->installedMap[$package->id]))) {
  9530. continue;
  9531. }
  9532. if ($literal > 0) {
  9533. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  9534. $source = $installMeansUpdateMap[abs($literal)];
  9535. $updateMap[$package->id] = array(
  9536. 'package' => $package,
  9537. 'source' => $source,
  9538. 'reason' => $reason,
  9539. );
  9540. unset($installMeansUpdateMap[abs($literal)]);
  9541. $ignoreRemove[$source->id] = true;
  9542. } else {
  9543. $installMap[$package->id] = array(
  9544. 'package' => $package,
  9545. 'reason' => $reason,
  9546. );
  9547. }
  9548. }
  9549. }
  9550. foreach ($this->decisions as $i => $decision) {
  9551. $literal = $decision[Decisions::DECISION_LITERAL];
  9552. $reason = $decision[Decisions::DECISION_REASON];
  9553. $package = $this->pool->literalToPackage($literal);
  9554. if ($literal <= 0 &&
  9555. isset($this->installedMap[$package->id]) &&
  9556. !isset($ignoreRemove[$package->id])) {
  9557. $uninstallMap[$package->id] = array(
  9558. 'package' => $package,
  9559. 'reason' => $reason,
  9560. );
  9561. }
  9562. }
  9563. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  9564. return $this->transaction;
  9565. }
  9566. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  9567. {
  9568. $queue = array_map(
  9569. function ($operation) {
  9570. return $operation['package'];
  9571. },
  9572. $this->findRootPackages($installMap, $updateMap)
  9573. );
  9574. $visited = array();
  9575. while (!empty($queue)) {
  9576. $package = array_pop($queue);
  9577. $packageId = $package->id;
  9578. if (!isset($visited[$packageId])) {
  9579. $queue[] = $package;
  9580. if ($package instanceof AliasPackage) {
  9581. $queue[] = $package->getAliasOf();
  9582. } else {
  9583. foreach ($package->getRequires() as $link) {
  9584. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9585. foreach ($possibleRequires as $require) {
  9586. $queue[] = $require;
  9587. }
  9588. }
  9589. }
  9590. $visited[$package->id] = true;
  9591. } else {
  9592. if (isset($installMap[$packageId])) {
  9593. $this->install(
  9594. $installMap[$packageId]['package'],
  9595. $installMap[$packageId]['reason']
  9596. );
  9597. unset($installMap[$packageId]);
  9598. }
  9599. if (isset($updateMap[$packageId])) {
  9600. $this->update(
  9601. $updateMap[$packageId]['source'],
  9602. $updateMap[$packageId]['package'],
  9603. $updateMap[$packageId]['reason']
  9604. );
  9605. unset($updateMap[$packageId]);
  9606. }
  9607. }
  9608. }
  9609. foreach ($uninstallMap as $uninstall) {
  9610. $this->uninstall($uninstall['package'], $uninstall['reason']);
  9611. }
  9612. }
  9613. protected function findRootPackages($installMap, $updateMap)
  9614. {
  9615. $packages = $installMap + $updateMap;
  9616. $roots = $packages;
  9617. foreach ($packages as $packageId => $operation) {
  9618. $package = $operation['package'];
  9619. if (!isset($roots[$packageId])) {
  9620. continue;
  9621. }
  9622. foreach ($package->getRequires() as $link) {
  9623. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9624. foreach ($possibleRequires as $require) {
  9625. if ($require !== $package) {
  9626. unset($roots[$require->id]);
  9627. }
  9628. }
  9629. }
  9630. }
  9631. return $roots;
  9632. }
  9633. protected function findUpdates()
  9634. {
  9635. $installMeansUpdateMap = array();
  9636. foreach ($this->decisions as $i => $decision) {
  9637. $literal = $decision[Decisions::DECISION_LITERAL];
  9638. $package = $this->pool->literalToPackage($literal);
  9639. if ($package instanceof AliasPackage) {
  9640. continue;
  9641. }
  9642. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  9643. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  9644. $literals = array($package->id);
  9645. foreach ($updates as $update) {
  9646. $literals[] = $update->id;
  9647. }
  9648. foreach ($literals as $updateLiteral) {
  9649. if ($updateLiteral !== $literal) {
  9650. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  9651. }
  9652. }
  9653. }
  9654. }
  9655. return $installMeansUpdateMap;
  9656. }
  9657. protected function install($package, $reason)
  9658. {
  9659. if ($package instanceof AliasPackage) {
  9660. return $this->markAliasInstalled($package, $reason);
  9661. }
  9662. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  9663. }
  9664. protected function update($from, $to, $reason)
  9665. {
  9666. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  9667. }
  9668. protected function uninstall($package, $reason)
  9669. {
  9670. if ($package instanceof AliasPackage) {
  9671. return $this->markAliasUninstalled($package, $reason);
  9672. }
  9673. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  9674. }
  9675. protected function markAliasInstalled($package, $reason)
  9676. {
  9677. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  9678. }
  9679. protected function markAliasUninstalled($package, $reason)
  9680. {
  9681. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  9682. }
  9683. }
  9684. <?php
  9685. namespace Composer\Downloader;
  9686. use Composer\Package\PackageInterface;
  9687. use Symfony\Component\Finder\Finder;
  9688. use Composer\IO\IOInterface;
  9689. abstract class ArchiveDownloader extends FileDownloader
  9690. {
  9691. public function download(PackageInterface $package, $path, $output = true)
  9692. {
  9693. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  9694. $retries = 3;
  9695. while ($retries--) {
  9696. $fileName = parent::download($package, $path, $output);
  9697. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  9698. try {
  9699. $this->filesystem->ensureDirectoryExists($temporaryDir);
  9700. try {
  9701. $this->extract($fileName, $temporaryDir);
  9702. } catch (\Exception $e) {
  9703. parent::clearLastCacheWrite($package);
  9704. throw $e;
  9705. }
  9706. $this->filesystem->unlink($fileName);
  9707. $contentDir = $this->getFolderContent($temporaryDir);
  9708. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  9709. $contentDir = $this->getFolderContent((string) reset($contentDir));
  9710. }
  9711. foreach ($contentDir as $file) {
  9712. $file = (string) $file;
  9713. $this->filesystem->rename($file, $path . '/' . basename($file));
  9714. }
  9715. $this->filesystem->removeDirectory($temporaryDir);
  9716. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  9717. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  9718. }
  9719. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  9720. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  9721. }
  9722. } catch (\Exception $e) {
  9723. $this->filesystem->removeDirectory($path);
  9724. $this->filesystem->removeDirectory($temporaryDir);
  9725. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  9726. $this->io->writeError('');
  9727. if ($this->io->isDebug()) {
  9728. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  9729. } else {
  9730. $this->io->writeError(' Invalid zip file, retrying...');
  9731. }
  9732. usleep(500000);
  9733. continue;
  9734. }
  9735. throw $e;
  9736. }
  9737. break;
  9738. }
  9739. }
  9740. protected function getFileName(PackageInterface $package, $path)
  9741. {
  9742. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  9743. }
  9744. abstract protected function extract($file, $path);
  9745. private function getFolderContent($dir)
  9746. {
  9747. $finder = Finder::create()
  9748. ->ignoreVCS(false)
  9749. ->ignoreDotFiles(false)
  9750. ->notName('.DS_Store')
  9751. ->depth(0)
  9752. ->in($dir);
  9753. return iterator_to_array($finder);
  9754. }
  9755. }
  9756. <?php
  9757. namespace Composer\Downloader;
  9758. use Composer\Package\PackageInterface;
  9759. interface ChangeReportInterface
  9760. {
  9761. public function getLocalChanges(PackageInterface $package, $path);
  9762. }
  9763. <?php
  9764. namespace Composer\Downloader;
  9765. use Composer\Package\PackageInterface;
  9766. use Composer\IO\IOInterface;
  9767. use Composer\Util\Filesystem;
  9768. class DownloadManager
  9769. {
  9770. private $io;
  9771. private $preferDist = false;
  9772. private $preferSource = false;
  9773. private $packagePreferences = array();
  9774. private $filesystem;
  9775. private $downloaders = array();
  9776. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  9777. {
  9778. $this->io = $io;
  9779. $this->preferSource = $preferSource;
  9780. $this->filesystem = $filesystem ?: new Filesystem();
  9781. }
  9782. public function setPreferSource($preferSource)
  9783. {
  9784. $this->preferSource = $preferSource;
  9785. return $this;
  9786. }
  9787. public function setPreferDist($preferDist)
  9788. {
  9789. $this->preferDist = $preferDist;
  9790. return $this;
  9791. }
  9792. public function setPreferences(array $preferences)
  9793. {
  9794. $this->packagePreferences = $preferences;
  9795. return $this;
  9796. }
  9797. public function setOutputProgress($outputProgress)
  9798. {
  9799. foreach ($this->downloaders as $downloader) {
  9800. $downloader->setOutputProgress($outputProgress);
  9801. }
  9802. return $this;
  9803. }
  9804. public function setDownloader($type, DownloaderInterface $downloader)
  9805. {
  9806. $type = strtolower($type);
  9807. $this->downloaders[$type] = $downloader;
  9808. return $this;
  9809. }
  9810. public function getDownloader($type)
  9811. {
  9812. $type = strtolower($type);
  9813. if (!isset($this->downloaders[$type])) {
  9814. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  9815. }
  9816. return $this->downloaders[$type];
  9817. }
  9818. public function getDownloaderForInstalledPackage(PackageInterface $package)
  9819. {
  9820. $installationSource = $package->getInstallationSource();
  9821. if ('metapackage' === $package->getType()) {
  9822. return;
  9823. }
  9824. if ('dist' === $installationSource) {
  9825. $downloader = $this->getDownloader($package->getDistType());
  9826. } elseif ('source' === $installationSource) {
  9827. $downloader = $this->getDownloader($package->getSourceType());
  9828. } else {
  9829. throw new \InvalidArgumentException(
  9830. 'Package '.$package.' seems not been installed properly'
  9831. );
  9832. }
  9833. if ($installationSource !== $downloader->getInstallationSource()) {
  9834. throw new \LogicException(sprintf(
  9835. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  9836. get_class($downloader), $downloader->getInstallationSource(), $installationSource, $package
  9837. ));
  9838. }
  9839. return $downloader;
  9840. }
  9841. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  9842. {
  9843. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  9844. $sourceType = $package->getSourceType();
  9845. $distType = $package->getDistType();
  9846. $sources = array();
  9847. if ($sourceType) {
  9848. $sources[] = 'source';
  9849. }
  9850. if ($distType) {
  9851. $sources[] = 'dist';
  9852. }
  9853. if (empty($sources)) {
  9854. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  9855. }
  9856. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  9857. $sources = array_reverse($sources);
  9858. }
  9859. $this->filesystem->ensureDirectoryExists($targetDir);
  9860. foreach ($sources as $i => $source) {
  9861. if (isset($e)) {
  9862. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  9863. }
  9864. $package->setInstallationSource($source);
  9865. try {
  9866. $downloader = $this->getDownloaderForInstalledPackage($package);
  9867. if ($downloader) {
  9868. $downloader->download($package, $targetDir);
  9869. }
  9870. break;
  9871. } catch (\RuntimeException $e) {
  9872. if ($i === count($sources) - 1) {
  9873. throw $e;
  9874. }
  9875. $this->io->writeError(
  9876. ' <warning>Failed to download '.
  9877. $package->getPrettyName().
  9878. ' from ' . $source . ': '.
  9879. $e->getMessage().'</warning>'
  9880. );
  9881. }
  9882. }
  9883. }
  9884. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  9885. {
  9886. $downloader = $this->getDownloaderForInstalledPackage($initial);
  9887. if (!$downloader) {
  9888. return;
  9889. }
  9890. $installationSource = $initial->getInstallationSource();
  9891. if ('dist' === $installationSource) {
  9892. $initialType = $initial->getDistType();
  9893. $targetType = $target->getDistType();
  9894. } else {
  9895. $initialType = $initial->getSourceType();
  9896. $targetType = $target->getSourceType();
  9897. }
  9898. if ($target->isDev() && 'dist' === $installationSource) {
  9899. $downloader->remove($initial, $targetDir);
  9900. $this->download($target, $targetDir);
  9901. return;
  9902. }
  9903. if ($initialType === $targetType) {
  9904. $target->setInstallationSource($installationSource);
  9905. try {
  9906. $downloader->update($initial, $target, $targetDir);
  9907. return;
  9908. } catch (\RuntimeException $e) {
  9909. if (!$this->io->isInteractive()) {
  9910. throw $e;
  9911. }
  9912. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  9913. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  9914. throw $e;
  9915. }
  9916. }
  9917. }
  9918. $downloader->remove($initial, $targetDir);
  9919. $this->download($target, $targetDir, 'source' === $installationSource);
  9920. }
  9921. public function remove(PackageInterface $package, $targetDir)
  9922. {
  9923. $downloader = $this->getDownloaderForInstalledPackage($package);
  9924. if ($downloader) {
  9925. $downloader->remove($package, $targetDir);
  9926. }
  9927. }
  9928. protected function resolvePackageInstallPreference(PackageInterface $package)
  9929. {
  9930. foreach ($this->packagePreferences as $pattern => $preference) {
  9931. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  9932. if (preg_match($pattern, $package->getName())) {
  9933. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  9934. return 'dist';
  9935. }
  9936. return 'source';
  9937. }
  9938. }
  9939. return $package->isDev() ? 'source' : 'dist';
  9940. }
  9941. }
  9942. <?php
  9943. namespace Composer\Downloader;
  9944. use Composer\Package\PackageInterface;
  9945. interface DownloaderInterface
  9946. {
  9947. public function getInstallationSource();
  9948. public function download(PackageInterface $package, $path);
  9949. public function update(PackageInterface $initial, PackageInterface $target, $path);
  9950. public function remove(PackageInterface $package, $path);
  9951. public function setOutputProgress($outputProgress);
  9952. }
  9953. <?php
  9954. namespace Composer\Downloader;
  9955. use Composer\Package\PackageInterface;
  9956. interface DvcsDownloaderInterface
  9957. {
  9958. public function getUnpushedChanges(PackageInterface $package, $path);
  9959. }
  9960. <?php
  9961. namespace Composer\Downloader;
  9962. use Composer\Config;
  9963. use Composer\Cache;
  9964. use Composer\Factory;
  9965. use Composer\IO\IOInterface;
  9966. use Composer\Package\PackageInterface;
  9967. use Composer\Plugin\PluginEvents;
  9968. use Composer\Plugin\PreFileDownloadEvent;
  9969. use Composer\EventDispatcher\EventDispatcher;
  9970. use Composer\Util\Filesystem;
  9971. use Composer\Util\RemoteFilesystem;
  9972. use Composer\Util\Url as UrlUtil;
  9973. class FileDownloader implements DownloaderInterface
  9974. {
  9975. protected $io;
  9976. protected $config;
  9977. protected $rfs;
  9978. protected $filesystem;
  9979. protected $cache;
  9980. protected $outputProgress = true;
  9981. private $lastCacheWrites = array();
  9982. private $eventDispatcher;
  9983. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  9984. {
  9985. $this->io = $io;
  9986. $this->config = $config;
  9987. $this->eventDispatcher = $eventDispatcher;
  9988. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  9989. $this->filesystem = $filesystem ?: new Filesystem();
  9990. $this->cache = $cache;
  9991. if ($this->cache && $this->cache->gcIsNecessary()) {
  9992. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  9993. }
  9994. }
  9995. public function getInstallationSource()
  9996. {
  9997. return 'dist';
  9998. }
  9999. public function download(PackageInterface $package, $path, $output = true)
  10000. {
  10001. if (!$package->getDistUrl()) {
  10002. throw new \InvalidArgumentException('The given package is missing url information');
  10003. }
  10004. if ($output) {
  10005. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  10006. }
  10007. $urls = $package->getDistUrls();
  10008. while ($url = array_shift($urls)) {
  10009. try {
  10010. $fileName = $this->doDownload($package, $path, $url);
  10011. break;
  10012. } catch (\Exception $e) {
  10013. if ($this->io->isDebug()) {
  10014. $this->io->writeError('');
  10015. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  10016. } elseif (count($urls)) {
  10017. $this->io->writeError('');
  10018. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  10019. }
  10020. if (!count($urls)) {
  10021. throw $e;
  10022. }
  10023. }
  10024. }
  10025. if ($output) {
  10026. $this->io->writeError('');
  10027. }
  10028. return $fileName;
  10029. }
  10030. protected function doDownload(PackageInterface $package, $path, $url)
  10031. {
  10032. $this->filesystem->emptyDirectory($path);
  10033. $fileName = $this->getFileName($package, $path);
  10034. $processedUrl = $this->processUrl($package, $url);
  10035. $hostname = parse_url($processedUrl, PHP_URL_HOST);
  10036. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  10037. if ($this->eventDispatcher) {
  10038. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  10039. }
  10040. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  10041. try {
  10042. $checksum = $package->getDistSha1Checksum();
  10043. $cacheKey = $this->getCacheKey($package, $processedUrl);
  10044. if (!$this->cache || ($checksum && $checksum !== $this->cache->sha1($cacheKey)) || !$this->cache->copyTo($cacheKey, $fileName)) {
  10045. if (!$this->outputProgress) {
  10046. $this->io->writeError('Downloading', false);
  10047. }
  10048. $retries = 3;
  10049. while ($retries--) {
  10050. try {
  10051. $rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  10052. break;
  10053. } catch (TransportException $e) {
  10054. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  10055. throw $e;
  10056. }
  10057. $this->io->writeError('');
  10058. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  10059. usleep(500000);
  10060. }
  10061. }
  10062. if (!$this->outputProgress) {
  10063. $this->io->writeError(' (<comment>100%</comment>)', false);
  10064. }
  10065. if ($this->cache) {
  10066. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  10067. $this->cache->copyFrom($cacheKey, $fileName);
  10068. }
  10069. } else {
  10070. $this->io->writeError('Loading from cache', false);
  10071. }
  10072. if (!file_exists($fileName)) {
  10073. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  10074. .' directory is writable and you have internet connectivity');
  10075. }
  10076. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  10077. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  10078. }
  10079. } catch (\Exception $e) {
  10080. $this->filesystem->removeDirectory($path);
  10081. $this->clearLastCacheWrite($package);
  10082. throw $e;
  10083. }
  10084. return $fileName;
  10085. }
  10086. public function setOutputProgress($outputProgress)
  10087. {
  10088. $this->outputProgress = $outputProgress;
  10089. return $this;
  10090. }
  10091. protected function clearLastCacheWrite(PackageInterface $package)
  10092. {
  10093. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  10094. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  10095. unset($this->lastCacheWrites[$package->getName()]);
  10096. }
  10097. }
  10098. public function update(PackageInterface $initial, PackageInterface $target, $path)
  10099. {
  10100. $name = $target->getName();
  10101. $from = $initial->getPrettyVersion();
  10102. $to = $target->getPrettyVersion();
  10103. $this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  10104. $this->remove($initial, $path, false);
  10105. $this->download($target, $path, false);
  10106. $this->io->writeError('');
  10107. }
  10108. public function remove(PackageInterface $package, $path, $output = true)
  10109. {
  10110. if ($output) {
  10111. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10112. }
  10113. if (!$this->filesystem->removeDirectory($path)) {
  10114. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10115. }
  10116. }
  10117. protected function getFileName(PackageInterface $package, $path)
  10118. {
  10119. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10120. }
  10121. protected function processUrl(PackageInterface $package, $url)
  10122. {
  10123. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  10124. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  10125. }
  10126. if ($package->getDistReference()) {
  10127. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  10128. }
  10129. return $url;
  10130. }
  10131. private function getCacheKey(PackageInterface $package, $processedUrl)
  10132. {
  10133. $cacheKey = sha1($processedUrl);
  10134. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  10135. }
  10136. }
  10137. <?php
  10138. namespace Composer\Downloader;
  10139. class FilesystemException extends \Exception
  10140. {
  10141. public function __construct($message = '', $code = 0, \Exception $previous = null)
  10142. {
  10143. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  10144. }
  10145. }
  10146. <?php
  10147. namespace Composer\Downloader;
  10148. use Composer\Package\PackageInterface;
  10149. use Composer\Util\ProcessExecutor;
  10150. class FossilDownloader extends VcsDownloader
  10151. {
  10152. public function doDownload(PackageInterface $package, $path, $url)
  10153. {
  10154. $this->config->prohibitUrlByConfig($url, $this->io);
  10155. $url = ProcessExecutor::escape($url);
  10156. $ref = ProcessExecutor::escape($package->getSourceReference());
  10157. $repoFile = $path . '.fossil';
  10158. $this->io->writeError("Cloning ".$package->getSourceReference());
  10159. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  10160. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10161. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10162. }
  10163. $command = sprintf('fossil open %s', ProcessExecutor::escape($repoFile));
  10164. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10165. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10166. }
  10167. $command = sprintf('fossil update %s', $ref);
  10168. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10169. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10170. }
  10171. }
  10172. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10173. {
  10174. $this->config->prohibitUrlByConfig($url, $this->io);
  10175. $url = ProcessExecutor::escape($url);
  10176. $ref = ProcessExecutor::escape($target->getSourceReference());
  10177. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10178. if (!$this->hasMetadataRepository($path)) {
  10179. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10180. }
  10181. $command = sprintf('fossil pull && fossil up %s', $ref);
  10182. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10183. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10184. }
  10185. }
  10186. public function getLocalChanges(PackageInterface $package, $path)
  10187. {
  10188. if (!$this->hasMetadataRepository($path)) {
  10189. return null;
  10190. }
  10191. $this->process->execute('fossil changes', $output, realpath($path));
  10192. return trim($output) ?: null;
  10193. }
  10194. protected function getCommitLogs($fromReference, $toReference, $path)
  10195. {
  10196. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', $toReference);
  10197. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10198. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10199. }
  10200. $log = '';
  10201. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  10202. foreach ($this->process->splitLines($output) as $line) {
  10203. if (preg_match($match, $line)) {
  10204. break;
  10205. }
  10206. $log .= $line;
  10207. }
  10208. return $log;
  10209. }
  10210. protected function hasMetadataRepository($path)
  10211. {
  10212. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  10213. }
  10214. }
  10215. <?php
  10216. namespace Composer\Downloader;
  10217. use Composer\Config;
  10218. use Composer\IO\IOInterface;
  10219. use Composer\Package\PackageInterface;
  10220. use Composer\Util\Filesystem;
  10221. use Composer\Util\Git as GitUtil;
  10222. use Composer\Util\Platform;
  10223. use Composer\Util\ProcessExecutor;
  10224. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  10225. {
  10226. private $hasStashedChanges = false;
  10227. private $hasDiscardedChanges = false;
  10228. private $gitUtil;
  10229. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10230. {
  10231. parent::__construct($io, $config, $process, $fs);
  10232. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  10233. }
  10234. public function doDownload(PackageInterface $package, $path, $url)
  10235. {
  10236. GitUtil::cleanEnv();
  10237. $path = $this->normalizePath($path);
  10238. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  10239. $ref = $package->getSourceReference();
  10240. $flag = Platform::isWindows() ? '/D ' : '';
  10241. $gitVersion = $this->gitUtil->getVersion();
  10242. $msg = "Cloning ".$this->getShortHash($ref);
  10243. $command = 'git clone --no-checkout %url% %path% && cd '.$flag.'%path% && git remote add composer %url% && git fetch composer';
  10244. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=')) {
  10245. $this->io->writeError('', true, IOInterface::DEBUG);
  10246. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  10247. try {
  10248. $this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref);
  10249. if (is_dir($cachePath)) {
  10250. $command =
  10251. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  10252. . '&& cd '.$flag.'%path% '
  10253. . '&& git remote set-url origin %url% && git remote add composer %url%';
  10254. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  10255. }
  10256. } catch (\RuntimeException $e) {
  10257. }
  10258. }
  10259. $this->io->writeError($msg);
  10260. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  10261. return str_replace(
  10262. array('%url%', '%path%', '%cachePath%'),
  10263. array(
  10264. ProcessExecutor::escape($url),
  10265. ProcessExecutor::escape($path),
  10266. ProcessExecutor::escape($cachePath),
  10267. ),
  10268. $command
  10269. );
  10270. };
  10271. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  10272. if ($url !== $package->getSourceUrl()) {
  10273. $this->updateOriginUrl($path, $package->getSourceUrl());
  10274. } else {
  10275. $this->setPushUrl($path, $url);
  10276. }
  10277. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  10278. if ($package->getDistReference() === $package->getSourceReference()) {
  10279. $package->setDistReference($newRef);
  10280. }
  10281. $package->setSourceReference($newRef);
  10282. }
  10283. }
  10284. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10285. {
  10286. GitUtil::cleanEnv();
  10287. if (!$this->hasMetadataRepository($path)) {
  10288. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10289. }
  10290. $updateOriginUrl = false;
  10291. if (
  10292. 0 === $this->process->execute('git remote -v', $output, $path)
  10293. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  10294. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  10295. ) {
  10296. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  10297. $updateOriginUrl = true;
  10298. }
  10299. }
  10300. $ref = $target->getSourceReference();
  10301. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  10302. $command = 'git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)';
  10303. $commandCallable = function ($url) use ($command, $ref) {
  10304. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($ref.'^{commit}'));
  10305. };
  10306. $this->gitUtil->runCommand($commandCallable, $url, $path);
  10307. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  10308. if ($target->getDistReference() === $target->getSourceReference()) {
  10309. $target->setDistReference($newRef);
  10310. }
  10311. $target->setSourceReference($newRef);
  10312. }
  10313. if ($updateOriginUrl) {
  10314. $this->updateOriginUrl($path, $target->getSourceUrl());
  10315. }
  10316. }
  10317. public function getLocalChanges(PackageInterface $package, $path)
  10318. {
  10319. GitUtil::cleanEnv();
  10320. if (!$this->hasMetadataRepository($path)) {
  10321. return;
  10322. }
  10323. $command = 'git status --porcelain --untracked-files=no';
  10324. if (0 !== $this->process->execute($command, $output, $path)) {
  10325. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10326. }
  10327. return trim($output) ?: null;
  10328. }
  10329. public function getUnpushedChanges(PackageInterface $package, $path)
  10330. {
  10331. GitUtil::cleanEnv();
  10332. $path = $this->normalizePath($path);
  10333. if (!$this->hasMetadataRepository($path)) {
  10334. return;
  10335. }
  10336. $command = 'git show-ref --head -d';
  10337. if (0 !== $this->process->execute($command, $output, $path)) {
  10338. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10339. }
  10340. $refs = trim($output);
  10341. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  10342. return;
  10343. }
  10344. $headRef = $match[1];
  10345. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  10346. return;
  10347. }
  10348. $branch = $matches[1][0];
  10349. $unpushedChanges = null;
  10350. for ($i = 0; $i <= 1; $i++) {
  10351. foreach ($matches[1] as $candidate) {
  10352. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  10353. $branch = $candidate;
  10354. $remoteBranch = $match[1];
  10355. break;
  10356. }
  10357. }
  10358. if (!isset($remoteBranch)) {
  10359. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  10360. } else {
  10361. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  10362. if (0 !== $this->process->execute($command, $output, $path)) {
  10363. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10364. }
  10365. $unpushedChanges = trim($output) ?: null;
  10366. }
  10367. if ($unpushedChanges && $i === 0) {
  10368. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  10369. }
  10370. if (!$unpushedChanges) {
  10371. break;
  10372. }
  10373. }
  10374. return $unpushedChanges;
  10375. }
  10376. protected function cleanChanges(PackageInterface $package, $path, $update)
  10377. {
  10378. GitUtil::cleanEnv();
  10379. $path = $this->normalizePath($path);
  10380. $unpushed = $this->getUnpushedChanges($package, $path);
  10381. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  10382. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  10383. }
  10384. if (!$changes = $this->getLocalChanges($package, $path)) {
  10385. return;
  10386. }
  10387. if (!$this->io->isInteractive()) {
  10388. $discardChanges = $this->config->get('discard-changes');
  10389. if (true === $discardChanges) {
  10390. return $this->discardChanges($path);
  10391. }
  10392. if ('stash' === $discardChanges) {
  10393. if (!$update) {
  10394. return parent::cleanChanges($package, $path, $update);
  10395. }
  10396. return $this->stashChanges($path);
  10397. }
  10398. return parent::cleanChanges($package, $path, $update);
  10399. }
  10400. $changes = array_map(function ($elem) {
  10401. return ' '.$elem;
  10402. }, preg_split('{\s*\r?\n\s*}', $changes));
  10403. $this->io->writeError(' <error>The package has modified files:</error>');
  10404. $this->io->writeError(array_slice($changes, 0, 10));
  10405. if (count($changes) > 10) {
  10406. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  10407. }
  10408. while (true) {
  10409. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  10410. case 'y':
  10411. $this->discardChanges($path);
  10412. break 2;
  10413. case 's':
  10414. if (!$update) {
  10415. goto help;
  10416. }
  10417. $this->stashChanges($path);
  10418. break 2;
  10419. case 'n':
  10420. throw new \RuntimeException('Update aborted');
  10421. case 'v':
  10422. $this->io->writeError($changes);
  10423. break;
  10424. case 'd':
  10425. $this->viewDiff($path);
  10426. break;
  10427. case '?':
  10428. default:
  10429. help:
  10430. $this->io->writeError(array(
  10431. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  10432. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  10433. ' v - view modified files',
  10434. ' d - view local modifications (diff)',
  10435. ));
  10436. if ($update) {
  10437. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  10438. }
  10439. $this->io->writeError(' ? - print help');
  10440. break;
  10441. }
  10442. }
  10443. }
  10444. protected function reapplyChanges($path)
  10445. {
  10446. $path = $this->normalizePath($path);
  10447. if ($this->hasStashedChanges) {
  10448. $this->hasStashedChanges = false;
  10449. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  10450. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  10451. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  10452. }
  10453. }
  10454. $this->hasDiscardedChanges = false;
  10455. }
  10456. protected function updateToCommit($path, $reference, $branch, $date)
  10457. {
  10458. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  10459. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  10460. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  10461. $branches = null;
  10462. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  10463. $branches = $output;
  10464. }
  10465. $gitRef = $reference;
  10466. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  10467. && $branches
  10468. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  10469. ) {
  10470. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  10471. if (0 === $this->process->execute($command, $output, $path)) {
  10472. return;
  10473. }
  10474. }
  10475. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  10476. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  10477. $branch = 'v' . $branch;
  10478. }
  10479. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  10480. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  10481. if (0 === $this->process->execute($command, $output, $path)
  10482. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  10483. ) {
  10484. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  10485. if (0 === $this->process->execute($command, $output, $path)) {
  10486. return;
  10487. }
  10488. }
  10489. }
  10490. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  10491. if (0 === $this->process->execute($command, $output, $path)) {
  10492. return;
  10493. }
  10494. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  10495. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  10496. }
  10497. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  10498. }
  10499. protected function updateOriginUrl($path, $url)
  10500. {
  10501. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  10502. $this->setPushUrl($path, $url);
  10503. }
  10504. protected function setPushUrl($path, $url)
  10505. {
  10506. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  10507. $protocols = $this->config->get('github-protocols');
  10508. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  10509. if (!in_array('ssh', $protocols, true)) {
  10510. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  10511. }
  10512. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  10513. $this->process->execute($cmd, $ignoredOutput, $path);
  10514. }
  10515. }
  10516. protected function getCommitLogs($fromReference, $toReference, $path)
  10517. {
  10518. $path = $this->normalizePath($path);
  10519. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', $fromReference, $toReference);
  10520. if (0 !== $this->process->execute($command, $output, $path)) {
  10521. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10522. }
  10523. return $output;
  10524. }
  10525. protected function discardChanges($path)
  10526. {
  10527. $path = $this->normalizePath($path);
  10528. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  10529. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  10530. }
  10531. $this->hasDiscardedChanges = true;
  10532. }
  10533. protected function stashChanges($path)
  10534. {
  10535. $path = $this->normalizePath($path);
  10536. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  10537. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  10538. }
  10539. $this->hasStashedChanges = true;
  10540. }
  10541. protected function viewDiff($path)
  10542. {
  10543. $path = $this->normalizePath($path);
  10544. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  10545. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  10546. }
  10547. $this->io->writeError($output);
  10548. }
  10549. protected function normalizePath($path)
  10550. {
  10551. if (Platform::isWindows() && strlen($path) > 0) {
  10552. $basePath = $path;
  10553. $removed = array();
  10554. while (!is_dir($basePath) && $basePath !== '\\') {
  10555. array_unshift($removed, basename($basePath));
  10556. $basePath = dirname($basePath);
  10557. }
  10558. if ($basePath === '\\') {
  10559. return $path;
  10560. }
  10561. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  10562. }
  10563. return $path;
  10564. }
  10565. protected function hasMetadataRepository($path)
  10566. {
  10567. $path = $this->normalizePath($path);
  10568. return is_dir($path.'/.git');
  10569. }
  10570. protected function getShortHash($reference)
  10571. {
  10572. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  10573. return substr($reference, 0, 10);
  10574. }
  10575. return $reference;
  10576. }
  10577. }
  10578. <?php
  10579. namespace Composer\Downloader;
  10580. use Composer\Config;
  10581. use Composer\Cache;
  10582. use Composer\EventDispatcher\EventDispatcher;
  10583. use Composer\Package\PackageInterface;
  10584. use Composer\Util\Platform;
  10585. use Composer\Util\ProcessExecutor;
  10586. use Composer\Util\RemoteFilesystem;
  10587. use Composer\IO\IOInterface;
  10588. class GzipDownloader extends ArchiveDownloader
  10589. {
  10590. protected $process;
  10591. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10592. {
  10593. $this->process = $process ?: new ProcessExecutor($io);
  10594. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10595. }
  10596. protected function extract($file, $path)
  10597. {
  10598. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  10599. if (!Platform::isWindows()) {
  10600. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  10601. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10602. return;
  10603. }
  10604. if (extension_loaded('zlib')) {
  10605. $this->extractUsingExt($file, $targetFilepath);
  10606. return;
  10607. }
  10608. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10609. throw new \RuntimeException($processError);
  10610. }
  10611. $this->extractUsingExt($file, $targetFilepath);
  10612. }
  10613. protected function getFileName(PackageInterface $package, $path)
  10614. {
  10615. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10616. }
  10617. private function extractUsingExt($file, $targetFilepath)
  10618. {
  10619. $archiveFile = gzopen($file, 'rb');
  10620. $targetFile = fopen($targetFilepath, 'wb');
  10621. while ($string = gzread($archiveFile, 4096)) {
  10622. fwrite($targetFile, $string, Platform::strlen($string));
  10623. }
  10624. gzclose($archiveFile);
  10625. fclose($targetFile);
  10626. }
  10627. }
  10628. <?php
  10629. namespace Composer\Downloader;
  10630. use Composer\Package\PackageInterface;
  10631. use Composer\Util\ProcessExecutor;
  10632. class HgDownloader extends VcsDownloader
  10633. {
  10634. public function doDownload(PackageInterface $package, $path, $url)
  10635. {
  10636. $this->config->prohibitUrlByConfig($url, $this->io);
  10637. $url = ProcessExecutor::escape($url);
  10638. $ref = ProcessExecutor::escape($package->getSourceReference());
  10639. $this->io->writeError("Cloning ".$package->getSourceReference());
  10640. $command = sprintf('hg clone %s %s', $url, ProcessExecutor::escape($path));
  10641. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10642. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10643. }
  10644. $command = sprintf('hg up %s', $ref);
  10645. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10646. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10647. }
  10648. }
  10649. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10650. {
  10651. $this->config->prohibitUrlByConfig($url, $this->io);
  10652. $url = ProcessExecutor::escape($url);
  10653. $ref = ProcessExecutor::escape($target->getSourceReference());
  10654. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10655. if (!$this->hasMetadataRepository($path)) {
  10656. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10657. }
  10658. $command = sprintf('hg pull %s && hg up %s', $url, $ref);
  10659. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10660. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10661. }
  10662. }
  10663. public function getLocalChanges(PackageInterface $package, $path)
  10664. {
  10665. if (!is_dir($path.'/.hg')) {
  10666. return null;
  10667. }
  10668. $this->process->execute('hg st', $output, realpath($path));
  10669. return trim($output) ?: null;
  10670. }
  10671. protected function getCommitLogs($fromReference, $toReference, $path)
  10672. {
  10673. $command = sprintf('hg log -r %s:%s --style compact', $fromReference, $toReference);
  10674. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10675. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10676. }
  10677. return $output;
  10678. }
  10679. protected function hasMetadataRepository($path)
  10680. {
  10681. return is_dir($path . '/.hg');
  10682. }
  10683. }
  10684. <?php
  10685. namespace Composer\Downloader;
  10686. use Composer\Package\Archiver\ArchivableFilesFinder;
  10687. use Composer\Package\Dumper\ArrayDumper;
  10688. use Composer\Package\PackageInterface;
  10689. use Composer\Package\Version\VersionGuesser;
  10690. use Composer\Package\Version\VersionParser;
  10691. use Composer\Util\Platform;
  10692. use Composer\Util\ProcessExecutor;
  10693. use Composer\Util\Filesystem as ComposerFilesystem;
  10694. use Symfony\Component\Filesystem\Exception\IOException;
  10695. use Symfony\Component\Filesystem\Filesystem;
  10696. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  10697. {
  10698. const STRATEGY_SYMLINK = 10;
  10699. const STRATEGY_MIRROR = 20;
  10700. public function download(PackageInterface $package, $path, $output = true)
  10701. {
  10702. $url = $package->getDistUrl();
  10703. $realUrl = realpath($url);
  10704. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  10705. throw new \RuntimeException(sprintf(
  10706. 'Source path "%s" is not found for package %s', $url, $package->getName()
  10707. ));
  10708. }
  10709. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  10710. throw new \RuntimeException(sprintf(
  10711. 'Package %s cannot install to "%s" inside its source at "%s"',
  10712. $package->getName(), realpath($path), $realUrl
  10713. ));
  10714. }
  10715. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  10716. $currentStrategy = self::STRATEGY_SYMLINK;
  10717. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  10718. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  10719. if ($mirrorPathRepos) {
  10720. $currentStrategy = self::STRATEGY_MIRROR;
  10721. }
  10722. if (true === $transportOptions['symlink']) {
  10723. $currentStrategy = self::STRATEGY_SYMLINK;
  10724. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  10725. } elseif (false === $transportOptions['symlink']) {
  10726. $currentStrategy = self::STRATEGY_MIRROR;
  10727. $allowedStrategies = array(self::STRATEGY_MIRROR);
  10728. }
  10729. $fileSystem = new Filesystem();
  10730. $this->filesystem->removeDirectory($path);
  10731. if ($output) {
  10732. $this->io->writeError(sprintf(
  10733. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  10734. $package->getName(),
  10735. $package->getFullPrettyVersion()
  10736. ), false);
  10737. }
  10738. $isFallback = false;
  10739. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  10740. try {
  10741. if (Platform::isWindows()) {
  10742. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  10743. $this->filesystem->junction($realUrl, $path);
  10744. } else {
  10745. $absolutePath = $path;
  10746. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  10747. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  10748. }
  10749. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  10750. $path = rtrim($path, "/");
  10751. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  10752. $fileSystem->symlink($shortestPath, $path);
  10753. }
  10754. } catch (IOException $e) {
  10755. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  10756. $this->io->writeError('');
  10757. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  10758. $currentStrategy = self::STRATEGY_MIRROR;
  10759. $isFallback = true;
  10760. } else {
  10761. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  10762. }
  10763. }
  10764. }
  10765. if (self::STRATEGY_MIRROR == $currentStrategy) {
  10766. $fs = new ComposerFilesystem();
  10767. $realUrl = $fs->normalizePath($realUrl);
  10768. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  10769. $iterator = new ArchivableFilesFinder($realUrl, array());
  10770. $fileSystem->mirror($realUrl, $path, $iterator);
  10771. }
  10772. $this->io->writeError('');
  10773. }
  10774. public function remove(PackageInterface $package, $path, $output = true)
  10775. {
  10776. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  10777. if ($output) {
  10778. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10779. }
  10780. if (!$this->filesystem->removeJunction($path)) {
  10781. $this->io->writeError(" <warn>Could not remove junction at " . $path . " - is another process locking it?</warn>");
  10782. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  10783. }
  10784. } else {
  10785. parent::remove($package, $path, $output);
  10786. }
  10787. }
  10788. public function getVcsReference(PackageInterface $package, $path)
  10789. {
  10790. $parser = new VersionParser;
  10791. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  10792. $dumper = new ArrayDumper;
  10793. $packageConfig = $dumper->dump($package);
  10794. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  10795. return $packageVersion['commit'];
  10796. }
  10797. }
  10798. }
  10799. <?php
  10800. namespace Composer\Downloader;
  10801. use Composer\Util\Filesystem;
  10802. class PearPackageExtractor
  10803. {
  10804. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  10805. private $filesystem;
  10806. private $file;
  10807. public function __construct($file)
  10808. {
  10809. if (!is_file($file)) {
  10810. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  10811. }
  10812. $this->filesystem = new Filesystem();
  10813. $this->file = $file;
  10814. }
  10815. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  10816. {
  10817. $extractionPath = $target.'/tarball';
  10818. try {
  10819. $archive = new \PharData($this->file);
  10820. $archive->extractTo($extractionPath, null, true);
  10821. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  10822. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  10823. }
  10824. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  10825. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  10826. $this->filesystem->removeDirectory($extractionPath);
  10827. } catch (\Exception $exception) {
  10828. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  10829. }
  10830. }
  10831. private function copyFiles($files, $source, $target, $roles, $vars)
  10832. {
  10833. foreach ($files as $file) {
  10834. $from = $this->combine($source, $file['from']);
  10835. $to = $this->combine($target, $roles[$file['role']]);
  10836. $to = $this->combine($to, $file['to']);
  10837. $tasks = $file['tasks'];
  10838. $this->copyFile($from, $to, $tasks, $vars);
  10839. }
  10840. }
  10841. private function copyFile($from, $to, $tasks, $vars)
  10842. {
  10843. if (!is_file($from)) {
  10844. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  10845. }
  10846. $this->filesystem->ensureDirectoryExists(dirname($to));
  10847. if (0 == count($tasks)) {
  10848. $copied = copy($from, $to);
  10849. } else {
  10850. $content = file_get_contents($from);
  10851. $replacements = array();
  10852. foreach ($tasks as $task) {
  10853. $pattern = $task['from'];
  10854. $varName = $task['to'];
  10855. if (isset($vars[$varName])) {
  10856. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  10857. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  10858. } else {
  10859. $replacements[$pattern] = $vars[$varName];
  10860. }
  10861. }
  10862. }
  10863. $content = strtr($content, $replacements);
  10864. $copied = file_put_contents($to, $content);
  10865. }
  10866. if (false === $copied) {
  10867. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  10868. }
  10869. }
  10870. private function buildCopyActions($source, array $roles, $vars)
  10871. {
  10872. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  10873. if (false === $package) {
  10874. throw new \RuntimeException('Package definition file is not valid.');
  10875. }
  10876. $packageSchemaVersion = $package['version'];
  10877. if ('1.0' == $packageSchemaVersion) {
  10878. $children = $package->release->filelist->children();
  10879. $packageName = (string) $package->name;
  10880. $packageVersion = (string) $package->release->version;
  10881. $sourceDir = $packageName . '-' . $packageVersion;
  10882. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  10883. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  10884. $children = $package->contents->children();
  10885. $packageName = (string) $package->name;
  10886. $packageVersion = (string) $package->version->release;
  10887. $sourceDir = $packageName . '-' . $packageVersion;
  10888. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  10889. $namespaces = $package->getNamespaces();
  10890. $package->registerXPathNamespace('ns', $namespaces['']);
  10891. $releaseNodes = $package->xpath('ns:phprelease');
  10892. $this->applyRelease($result, $releaseNodes, $vars);
  10893. } else {
  10894. throw new \RuntimeException('Unsupported schema version of package definition file.');
  10895. }
  10896. return $result;
  10897. }
  10898. private function applyRelease(&$actions, $releaseNodes, $vars)
  10899. {
  10900. foreach ($releaseNodes as $releaseNode) {
  10901. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  10902. if ($requiredOs && $vars['os'] != $requiredOs) {
  10903. continue;
  10904. }
  10905. if ($releaseNode->filelist) {
  10906. foreach ($releaseNode->filelist->children() as $action) {
  10907. if ('install' == $action->getName()) {
  10908. $name = (string) $action['name'];
  10909. $as = (string) $action['as'];
  10910. if (isset($actions[$name])) {
  10911. $actions[$name]['to'] = $as;
  10912. }
  10913. } elseif ('ignore' == $action->getName()) {
  10914. $name = (string) $action['name'];
  10915. unset($actions[$name]);
  10916. } else {
  10917. }
  10918. }
  10919. }
  10920. break;
  10921. }
  10922. }
  10923. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  10924. {
  10925. $result = array();
  10926. foreach ($children as $child) {
  10927. if ($child->getName() == 'dir') {
  10928. $dirSource = $this->combine($source, (string) $child['name']);
  10929. $dirTarget = $child['baseinstalldir'] ?: $target;
  10930. $dirRole = $child['role'] ?: $role;
  10931. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  10932. $result = array_merge($result, $dirFiles);
  10933. } elseif ($child->getName() == 'file') {
  10934. $fileRole = (string) $child['role'] ?: $role;
  10935. if (isset($targetRoles[$fileRole])) {
  10936. $fileName = (string) ($child['name'] ?: $child[0]);
  10937. $fileSource = $this->combine($source, $fileName);
  10938. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  10939. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  10940. $fileTarget = $packageName . '/' . $fileTarget;
  10941. }
  10942. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  10943. }
  10944. }
  10945. }
  10946. return $result;
  10947. }
  10948. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  10949. {
  10950. $result = array();
  10951. foreach ($children as $child) {
  10952. if ('dir' == $child->getName()) {
  10953. $dirSource = $this->combine($source, $child['name']);
  10954. $dirTarget = $child['baseinstalldir'] ?: $target;
  10955. $dirRole = $child['role'] ?: $role;
  10956. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  10957. $result = array_merge($result, $dirFiles);
  10958. } elseif ('file' == $child->getName()) {
  10959. $fileRole = (string) $child['role'] ?: $role;
  10960. if (isset($targetRoles[$fileRole])) {
  10961. $fileSource = $this->combine($source, (string) $child['name']);
  10962. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  10963. $fileTasks = array();
  10964. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  10965. if ('replace' == $taskNode->getName()) {
  10966. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  10967. }
  10968. }
  10969. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  10970. $fileTarget = $packageName . '/' . $fileTarget;
  10971. }
  10972. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  10973. }
  10974. }
  10975. }
  10976. return $result;
  10977. }
  10978. private function combine($left, $right)
  10979. {
  10980. return rtrim($left, '/') . '/' . ltrim($right, '/');
  10981. }
  10982. }
  10983. <?php
  10984. namespace Composer\Downloader;
  10985. use Composer\Package\PackageInterface;
  10986. use Composer\Repository\VcsRepository;
  10987. use Composer\Util\Perforce;
  10988. class PerforceDownloader extends VcsDownloader
  10989. {
  10990. protected $perforce;
  10991. public function doDownload(PackageInterface $package, $path, $url)
  10992. {
  10993. $ref = $package->getSourceReference();
  10994. $label = $this->getLabelFromSourceReference($ref);
  10995. $this->io->writeError('Cloning ' . $ref);
  10996. $this->initPerforce($package, $path, $url);
  10997. $this->perforce->setStream($ref);
  10998. $this->perforce->p4Login();
  10999. $this->perforce->writeP4ClientSpec();
  11000. $this->perforce->connectClient();
  11001. $this->perforce->syncCodeBase($label);
  11002. $this->perforce->cleanupClientSpec();
  11003. }
  11004. private function getLabelFromSourceReference($ref)
  11005. {
  11006. $pos = strpos($ref, '@');
  11007. if (false !== $pos) {
  11008. return substr($ref, $pos + 1);
  11009. }
  11010. return null;
  11011. }
  11012. public function initPerforce(PackageInterface $package, $path, $url)
  11013. {
  11014. if (!empty($this->perforce)) {
  11015. $this->perforce->initializePath($path);
  11016. return;
  11017. }
  11018. $repository = $package->getRepository();
  11019. $repoConfig = null;
  11020. if ($repository instanceof VcsRepository) {
  11021. $repoConfig = $this->getRepoConfig($repository);
  11022. }
  11023. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  11024. }
  11025. private function getRepoConfig(VcsRepository $repository)
  11026. {
  11027. return $repository->getRepoConfig();
  11028. }
  11029. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11030. {
  11031. $this->doDownload($target, $path, $url);
  11032. }
  11033. public function getLocalChanges(PackageInterface $package, $path)
  11034. {
  11035. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  11036. return;
  11037. }
  11038. protected function getCommitLogs($fromReference, $toReference, $path)
  11039. {
  11040. return $this->perforce->getCommitLogs($fromReference, $toReference);
  11041. }
  11042. public function setPerforce($perforce)
  11043. {
  11044. $this->perforce = $perforce;
  11045. }
  11046. protected function hasMetadataRepository($path)
  11047. {
  11048. return true;
  11049. }
  11050. }
  11051. <?php
  11052. namespace Composer\Downloader;
  11053. class PharDownloader extends ArchiveDownloader
  11054. {
  11055. protected function extract($file, $path)
  11056. {
  11057. $archive = new \Phar($file);
  11058. $archive->extractTo($path, null, true);
  11059. }
  11060. }
  11061. <?php
  11062. namespace Composer\Downloader;
  11063. use Composer\Config;
  11064. use Composer\Cache;
  11065. use Composer\EventDispatcher\EventDispatcher;
  11066. use Composer\Util\IniHelper;
  11067. use Composer\Util\Platform;
  11068. use Composer\Util\ProcessExecutor;
  11069. use Composer\Util\RemoteFilesystem;
  11070. use Composer\IO\IOInterface;
  11071. use RarArchive;
  11072. class RarDownloader extends ArchiveDownloader
  11073. {
  11074. protected $process;
  11075. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11076. {
  11077. $this->process = $process ?: new ProcessExecutor($io);
  11078. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11079. }
  11080. protected function extract($file, $path)
  11081. {
  11082. $processError = null;
  11083. if (!Platform::isWindows()) {
  11084. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  11085. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11086. return;
  11087. }
  11088. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11089. }
  11090. if (!class_exists('RarArchive')) {
  11091. $iniMessage = IniHelper::getMessage();
  11092. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  11093. . $iniMessage . "\n" . $processError;
  11094. if (!Platform::isWindows()) {
  11095. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  11096. }
  11097. throw new \RuntimeException($error);
  11098. }
  11099. $rarArchive = RarArchive::open($file);
  11100. if (false === $rarArchive) {
  11101. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  11102. }
  11103. $entries = $rarArchive->getEntries();
  11104. if (false === $entries) {
  11105. throw new \RuntimeException('Could not retrieve RAR archive entries');
  11106. }
  11107. foreach ($entries as $entry) {
  11108. if (false === $entry->extract($path)) {
  11109. throw new \RuntimeException('Could not extract entry');
  11110. }
  11111. }
  11112. $rarArchive->close();
  11113. }
  11114. }
  11115. <?php
  11116. namespace Composer\Downloader;
  11117. use Composer\Package\PackageInterface;
  11118. use Composer\Util\Svn as SvnUtil;
  11119. use Composer\Repository\VcsRepository;
  11120. use Composer\Util\ProcessExecutor;
  11121. class SvnDownloader extends VcsDownloader
  11122. {
  11123. protected $cacheCredentials = true;
  11124. public function doDownload(PackageInterface $package, $path, $url)
  11125. {
  11126. SvnUtil::cleanEnv();
  11127. $ref = $package->getSourceReference();
  11128. $repo = $package->getRepository();
  11129. if ($repo instanceof VcsRepository) {
  11130. $repoConfig = $repo->getRepoConfig();
  11131. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  11132. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  11133. }
  11134. }
  11135. $this->io->writeError(" Checking out ".$package->getSourceReference());
  11136. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  11137. }
  11138. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11139. {
  11140. SvnUtil::cleanEnv();
  11141. $ref = $target->getSourceReference();
  11142. if (!$this->hasMetadataRepository($path)) {
  11143. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11144. }
  11145. $flags = "";
  11146. if (0 === $this->process->execute('svn --version', $output)) {
  11147. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match) && version_compare($match[1], '1.7.0', '>=')) {
  11148. $flags .= ' --ignore-ancestry';
  11149. }
  11150. }
  11151. $this->io->writeError(" Checking out " . $ref);
  11152. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  11153. }
  11154. public function getLocalChanges(PackageInterface $package, $path)
  11155. {
  11156. if (!$this->hasMetadataRepository($path)) {
  11157. return null;
  11158. }
  11159. $this->process->execute('svn status --ignore-externals', $output, $path);
  11160. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  11161. }
  11162. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  11163. {
  11164. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11165. $util->setCacheCredentials($this->cacheCredentials);
  11166. try {
  11167. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  11168. } catch (\RuntimeException $e) {
  11169. throw new \RuntimeException(
  11170. 'Package could not be downloaded, '.$e->getMessage()
  11171. );
  11172. }
  11173. }
  11174. protected function cleanChanges(PackageInterface $package, $path, $update)
  11175. {
  11176. if (!$changes = $this->getLocalChanges($package, $path)) {
  11177. return;
  11178. }
  11179. if (!$this->io->isInteractive()) {
  11180. if (true === $this->config->get('discard-changes')) {
  11181. return $this->discardChanges($path);
  11182. }
  11183. return parent::cleanChanges($package, $path, $update);
  11184. }
  11185. $changes = array_map(function ($elem) {
  11186. return ' '.$elem;
  11187. }, preg_split('{\s*\r?\n\s*}', $changes));
  11188. $countChanges = count($changes);
  11189. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  11190. $this->io->writeError(array_slice($changes, 0, 10));
  11191. if ($countChanges > 10) {
  11192. $remaingChanges = $countChanges - 10;
  11193. $this->io->writeError(
  11194. sprintf(
  11195. ' <info>'.$remaingChanges.' more file%s modified, choose "v" to view the full list</info>',
  11196. $remaingChanges === 1 ? '' : 's'
  11197. )
  11198. );
  11199. }
  11200. while (true) {
  11201. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  11202. case 'y':
  11203. $this->discardChanges($path);
  11204. break 2;
  11205. case 'n':
  11206. throw new \RuntimeException('Update aborted');
  11207. case 'v':
  11208. $this->io->writeError($changes);
  11209. break;
  11210. case '?':
  11211. default:
  11212. $this->io->writeError(array(
  11213. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11214. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11215. ' v - view modified files',
  11216. ' ? - print help',
  11217. ));
  11218. break;
  11219. }
  11220. }
  11221. }
  11222. protected function getCommitLogs($fromReference, $toReference, $path)
  11223. {
  11224. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  11225. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  11226. if (0 !== $this->process->execute($command, $output, $path)) {
  11227. throw new \RuntimeException(
  11228. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  11229. );
  11230. }
  11231. $urlPattern = '#<url>(.*)</url>#';
  11232. if (preg_match($urlPattern, $output, $matches)) {
  11233. $baseUrl = $matches[1];
  11234. } else {
  11235. throw new \RuntimeException(
  11236. 'Unable to determine svn url for path '. $path
  11237. );
  11238. }
  11239. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  11240. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  11241. $command = sprintf('svn log -r%s:%s --incremental', $fromRevision, $toRevision);
  11242. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11243. $util->setCacheCredentials($this->cacheCredentials);
  11244. try {
  11245. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  11246. } catch (\RuntimeException $e) {
  11247. throw new \RuntimeException(
  11248. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  11249. );
  11250. }
  11251. }
  11252. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  11253. }
  11254. protected function discardChanges($path)
  11255. {
  11256. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  11257. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11258. }
  11259. }
  11260. protected function hasMetadataRepository($path)
  11261. {
  11262. return is_dir($path.'/.svn');
  11263. }
  11264. }
  11265. <?php
  11266. namespace Composer\Downloader;
  11267. class TarDownloader extends ArchiveDownloader
  11268. {
  11269. protected function extract($file, $path)
  11270. {
  11271. $archive = new \PharData($file);
  11272. $archive->extractTo($path, null, true);
  11273. }
  11274. }
  11275. <?php
  11276. namespace Composer\Downloader;
  11277. class TransportException extends \RuntimeException
  11278. {
  11279. protected $headers;
  11280. protected $response;
  11281. protected $statusCode;
  11282. public function setHeaders($headers)
  11283. {
  11284. $this->headers = $headers;
  11285. }
  11286. public function getHeaders()
  11287. {
  11288. return $this->headers;
  11289. }
  11290. public function setResponse($response)
  11291. {
  11292. $this->response = $response;
  11293. }
  11294. public function getResponse()
  11295. {
  11296. return $this->response;
  11297. }
  11298. public function setStatusCode($statusCode)
  11299. {
  11300. $this->statusCode = $statusCode;
  11301. }
  11302. public function getStatusCode()
  11303. {
  11304. return $this->statusCode;
  11305. }
  11306. }
  11307. <?php
  11308. namespace Composer\Downloader;
  11309. use Composer\Package\PackageInterface;
  11310. interface VcsCapableDownloaderInterface
  11311. {
  11312. public function getVcsReference(PackageInterface $package, $path);
  11313. }
  11314. <?php
  11315. namespace Composer\Downloader;
  11316. use Composer\Config;
  11317. use Composer\Package\Dumper\ArrayDumper;
  11318. use Composer\Package\PackageInterface;
  11319. use Composer\Package\Version\VersionGuesser;
  11320. use Composer\Package\Version\VersionParser;
  11321. use Composer\Util\ProcessExecutor;
  11322. use Composer\IO\IOInterface;
  11323. use Composer\Util\Filesystem;
  11324. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  11325. {
  11326. protected $io;
  11327. protected $config;
  11328. protected $process;
  11329. protected $filesystem;
  11330. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11331. {
  11332. $this->io = $io;
  11333. $this->config = $config;
  11334. $this->process = $process ?: new ProcessExecutor($io);
  11335. $this->filesystem = $fs ?: new Filesystem($this->process);
  11336. }
  11337. public function getInstallationSource()
  11338. {
  11339. return 'source';
  11340. }
  11341. public function download(PackageInterface $package, $path)
  11342. {
  11343. if (!$package->getSourceReference()) {
  11344. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  11345. }
  11346. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11347. $this->filesystem->emptyDirectory($path);
  11348. $urls = $package->getSourceUrls();
  11349. while ($url = array_shift($urls)) {
  11350. try {
  11351. if (Filesystem::isLocalPath($url)) {
  11352. $needle = 'file://';
  11353. $isFileProtocol = false;
  11354. if (0 === strpos($url, $needle)) {
  11355. $url = substr($url, strlen($needle));
  11356. $isFileProtocol = true;
  11357. }
  11358. if (false !== strpos($url, '%')) {
  11359. $url = rawurldecode($url);
  11360. }
  11361. $url = realpath($url);
  11362. if ($isFileProtocol) {
  11363. $url = $needle . $url;
  11364. }
  11365. }
  11366. $this->doDownload($package, $path, $url);
  11367. break;
  11368. } catch (\Exception $e) {
  11369. if ($e instanceof \PHPUnit_Framework_Exception) {
  11370. throw $e;
  11371. }
  11372. if ($this->io->isDebug()) {
  11373. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  11374. } elseif (count($urls)) {
  11375. $this->io->writeError(' Failed, trying the next URL');
  11376. }
  11377. if (!count($urls)) {
  11378. throw $e;
  11379. }
  11380. }
  11381. }
  11382. }
  11383. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11384. {
  11385. if (!$target->getSourceReference()) {
  11386. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  11387. }
  11388. $name = $target->getName();
  11389. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  11390. if ($target->getSourceType() === 'svn') {
  11391. $from = $initial->getSourceReference();
  11392. $to = $target->getSourceReference();
  11393. } else {
  11394. $from = substr($initial->getSourceReference(), 0, 7);
  11395. $to = substr($target->getSourceReference(), 0, 7);
  11396. }
  11397. $name .= ' '.$initial->getPrettyVersion();
  11398. } else {
  11399. $from = $initial->getFullPrettyVersion();
  11400. $to = $target->getFullPrettyVersion();
  11401. }
  11402. $this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11403. $this->cleanChanges($initial, $path, true);
  11404. $urls = $target->getSourceUrls();
  11405. $exception = null;
  11406. while ($url = array_shift($urls)) {
  11407. try {
  11408. if (Filesystem::isLocalPath($url)) {
  11409. $url = realpath($url);
  11410. }
  11411. $this->doUpdate($initial, $target, $path, $url);
  11412. $exception = null;
  11413. break;
  11414. } catch (\Exception $exception) {
  11415. if ($exception instanceof \PHPUnit_Framework_Exception) {
  11416. throw $exception;
  11417. }
  11418. if ($this->io->isDebug()) {
  11419. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  11420. } elseif (count($urls)) {
  11421. $this->io->writeError(' Failed, trying the next URL');
  11422. }
  11423. }
  11424. }
  11425. $this->reapplyChanges($path);
  11426. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  11427. $message = 'Pulling in changes:';
  11428. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  11429. if (!trim($logs)) {
  11430. $message = 'Rolling back changes:';
  11431. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  11432. }
  11433. if (trim($logs)) {
  11434. $logs = implode("\n", array_map(function ($line) {
  11435. return ' ' . $line;
  11436. }, explode("\n", $logs)));
  11437. $logs = str_replace('<', '\<', $logs);
  11438. $this->io->writeError(' '.$message);
  11439. $this->io->writeError($logs);
  11440. }
  11441. }
  11442. if (!$urls && $exception) {
  11443. throw $exception;
  11444. }
  11445. }
  11446. public function remove(PackageInterface $package, $path)
  11447. {
  11448. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  11449. $this->cleanChanges($package, $path, false);
  11450. if (!$this->filesystem->removeDirectory($path)) {
  11451. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  11452. }
  11453. }
  11454. public function setOutputProgress($outputProgress)
  11455. {
  11456. return $this;
  11457. }
  11458. public function getVcsReference(PackageInterface $package, $path)
  11459. {
  11460. $parser = new VersionParser;
  11461. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  11462. $dumper = new ArrayDumper;
  11463. $packageConfig = $dumper->dump($package);
  11464. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11465. return $packageVersion['commit'];
  11466. }
  11467. }
  11468. protected function cleanChanges(PackageInterface $package, $path, $update)
  11469. {
  11470. if (null !== $this->getLocalChanges($package, $path)) {
  11471. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  11472. }
  11473. }
  11474. protected function reapplyChanges($path)
  11475. {
  11476. }
  11477. abstract protected function doDownload(PackageInterface $package, $path, $url);
  11478. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  11479. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  11480. abstract protected function hasMetadataRepository($path);
  11481. }
  11482. <?php
  11483. namespace Composer\Downloader;
  11484. use Composer\Config;
  11485. use Composer\Cache;
  11486. use Composer\EventDispatcher\EventDispatcher;
  11487. use Composer\Package\PackageInterface;
  11488. use Composer\Util\ProcessExecutor;
  11489. use Composer\Util\RemoteFilesystem;
  11490. use Composer\IO\IOInterface;
  11491. class XzDownloader extends ArchiveDownloader
  11492. {
  11493. protected $process;
  11494. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11495. {
  11496. $this->process = $process ?: new ProcessExecutor($io);
  11497. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11498. }
  11499. protected function extract($file, $path)
  11500. {
  11501. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  11502. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11503. return;
  11504. }
  11505. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11506. throw new \RuntimeException($processError);
  11507. }
  11508. protected function getFileName(PackageInterface $package, $path)
  11509. {
  11510. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11511. }
  11512. }
  11513. <?php
  11514. namespace Composer\Downloader;
  11515. use Composer\Config;
  11516. use Composer\Cache;
  11517. use Composer\EventDispatcher\EventDispatcher;
  11518. use Composer\Package\PackageInterface;
  11519. use Composer\Util\IniHelper;
  11520. use Composer\Util\Platform;
  11521. use Composer\Util\ProcessExecutor;
  11522. use Composer\Util\RemoteFilesystem;
  11523. use Composer\IO\IOInterface;
  11524. use Symfony\Component\Process\ExecutableFinder;
  11525. use ZipArchive;
  11526. class ZipDownloader extends ArchiveDownloader
  11527. {
  11528. protected static $hasSystemUnzip;
  11529. private static $hasZipArchive;
  11530. private static $isWindows;
  11531. protected $process;
  11532. private $zipArchiveObject;
  11533. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11534. {
  11535. $this->process = $process ?: new ProcessExecutor($io);
  11536. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11537. }
  11538. public function download(PackageInterface $package, $path, $output = true)
  11539. {
  11540. if (null === self::$hasSystemUnzip) {
  11541. $finder = new ExecutableFinder;
  11542. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  11543. }
  11544. if (null === self::$hasZipArchive) {
  11545. self::$hasZipArchive = class_exists('ZipArchive');
  11546. }
  11547. if (null === self::$isWindows) {
  11548. self::$isWindows = Platform::isWindows();
  11549. }
  11550. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  11551. $iniMessage = IniHelper::getMessage();
  11552. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  11553. throw new \RuntimeException($error);
  11554. }
  11555. return parent::download($package, $path, $output);
  11556. }
  11557. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  11558. {
  11559. if (!self::$hasZipArchive) {
  11560. $isLastChance = true;
  11561. }
  11562. if (!self::$hasSystemUnzip && !$isLastChance) {
  11563. return $this->extractWithZipArchive($file, $path, true);
  11564. }
  11565. $processError = null;
  11566. $overwrite = $isLastChance ? '-o' : '';
  11567. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  11568. try {
  11569. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11570. return true;
  11571. }
  11572. $processError = new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11573. } catch (\Exception $e) {
  11574. $processError = $e;
  11575. }
  11576. if ($isLastChance) {
  11577. throw $processError;
  11578. }
  11579. $this->io->writeError(' '.$processError->getMessage());
  11580. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  11581. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  11582. return $this->extractWithZipArchive($file, $path, true);
  11583. }
  11584. protected function extractWithZipArchive($file, $path, $isLastChance)
  11585. {
  11586. if (!self::$hasSystemUnzip) {
  11587. $isLastChance = true;
  11588. }
  11589. if (!self::$hasZipArchive && !$isLastChance) {
  11590. return $this->extractWithSystemUnzip($file, $path, true);
  11591. }
  11592. $processError = null;
  11593. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  11594. try {
  11595. if (true === ($retval = $zipArchive->open($file))) {
  11596. $extractResult = $zipArchive->extractTo($path);
  11597. if (true === $extractResult) {
  11598. $zipArchive->close();
  11599. return true;
  11600. }
  11601. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  11602. } else {
  11603. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  11604. }
  11605. } catch (\ErrorException $e) {
  11606. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  11607. } catch (\Exception $e) {
  11608. $processError = $e;
  11609. }
  11610. if ($isLastChance) {
  11611. throw $processError;
  11612. }
  11613. $this->io->writeError(' '.$processError->getMessage());
  11614. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  11615. return $this->extractWithSystemUnzip($file, $path, true);
  11616. }
  11617. public function extract($file, $path)
  11618. {
  11619. if (self::$isWindows) {
  11620. $this->extractWithZipArchive($file, $path, false);
  11621. } else {
  11622. $this->extractWithSystemUnzip($file, $path, false);
  11623. }
  11624. }
  11625. protected function getErrorMessage($retval, $file)
  11626. {
  11627. switch ($retval) {
  11628. case ZipArchive::ER_EXISTS:
  11629. return sprintf("File '%s' already exists.", $file);
  11630. case ZipArchive::ER_INCONS:
  11631. return sprintf("Zip archive '%s' is inconsistent.", $file);
  11632. case ZipArchive::ER_INVAL:
  11633. return sprintf("Invalid argument (%s)", $file);
  11634. case ZipArchive::ER_MEMORY:
  11635. return sprintf("Malloc failure (%s)", $file);
  11636. case ZipArchive::ER_NOENT:
  11637. return sprintf("No such zip file: '%s'", $file);
  11638. case ZipArchive::ER_NOZIP:
  11639. return sprintf("'%s' is not a zip archive.", $file);
  11640. case ZipArchive::ER_OPEN:
  11641. return sprintf("Can't open zip file: %s", $file);
  11642. case ZipArchive::ER_READ:
  11643. return sprintf("Zip read error (%s)", $file);
  11644. case ZipArchive::ER_SEEK:
  11645. return sprintf("Zip seek error (%s)", $file);
  11646. default:
  11647. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  11648. }
  11649. }
  11650. }
  11651. <?php
  11652. namespace Composer\EventDispatcher;
  11653. class Event
  11654. {
  11655. protected $name;
  11656. protected $args;
  11657. protected $flags;
  11658. private $propagationStopped = false;
  11659. public function __construct($name, array $args = array(), array $flags = array())
  11660. {
  11661. $this->name = $name;
  11662. $this->args = $args;
  11663. $this->flags = $flags;
  11664. }
  11665. public function getName()
  11666. {
  11667. return $this->name;
  11668. }
  11669. public function getArguments()
  11670. {
  11671. return $this->args;
  11672. }
  11673. public function getFlags()
  11674. {
  11675. return $this->flags;
  11676. }
  11677. public function isPropagationStopped()
  11678. {
  11679. return $this->propagationStopped;
  11680. }
  11681. public function stopPropagation()
  11682. {
  11683. $this->propagationStopped = true;
  11684. }
  11685. }
  11686. <?php
  11687. namespace Composer\EventDispatcher;
  11688. use Composer\DependencyResolver\PolicyInterface;
  11689. use Composer\DependencyResolver\Pool;
  11690. use Composer\DependencyResolver\Request;
  11691. use Composer\Installer\InstallerEvent;
  11692. use Composer\IO\IOInterface;
  11693. use Composer\Composer;
  11694. use Composer\DependencyResolver\Operation\OperationInterface;
  11695. use Composer\Repository\CompositeRepository;
  11696. use Composer\Script;
  11697. use Composer\Installer\PackageEvent;
  11698. use Composer\Installer\BinaryInstaller;
  11699. use Composer\Util\ProcessExecutor;
  11700. use Composer\Script\Event as ScriptEvent;
  11701. use Symfony\Component\Process\PhpExecutableFinder;
  11702. class EventDispatcher
  11703. {
  11704. protected $composer;
  11705. protected $io;
  11706. protected $loader;
  11707. protected $process;
  11708. protected $listeners;
  11709. private $eventStack;
  11710. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  11711. {
  11712. $this->composer = $composer;
  11713. $this->io = $io;
  11714. $this->process = $process ?: new ProcessExecutor($io);
  11715. $this->eventStack = array();
  11716. }
  11717. public function dispatch($eventName, Event $event = null)
  11718. {
  11719. if (null === $event) {
  11720. $event = new Event($eventName);
  11721. }
  11722. return $this->doDispatch($event);
  11723. }
  11724. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  11725. {
  11726. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  11727. }
  11728. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  11729. {
  11730. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  11731. }
  11732. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  11733. {
  11734. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  11735. }
  11736. protected function doDispatch(Event $event)
  11737. {
  11738. $pathStr = 'PATH';
  11739. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  11740. $pathStr = 'Path';
  11741. }
  11742. $binDir = $this->composer->getConfig()->get('bin-dir');
  11743. if (is_dir($binDir)) {
  11744. $binDir = realpath($binDir);
  11745. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  11746. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  11747. putenv($pathStr.'='.$_SERVER[$pathStr]);
  11748. }
  11749. }
  11750. $listeners = $this->getListeners($event);
  11751. $this->pushEvent($event);
  11752. $return = 0;
  11753. foreach ($listeners as $callable) {
  11754. if (!is_string($callable) && is_callable($callable)) {
  11755. $event = $this->checkListenerExpectedEvent($callable, $event);
  11756. $return = false === call_user_func($callable, $event) ? 1 : 0;
  11757. } elseif ($this->isComposerScript($callable)) {
  11758. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  11759. $scriptName = substr($callable, 1);
  11760. $args = $event->getArguments();
  11761. $flags = $event->getFlags();
  11762. if (substr($callable, 0, 10) === '@composer ') {
  11763. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  11764. if (0 !== ($exitCode = $this->process->execute($exec))) {
  11765. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  11766. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  11767. }
  11768. } else {
  11769. if (!$this->getListeners(new Event($scriptName))) {
  11770. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  11771. }
  11772. $return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
  11773. }
  11774. } elseif ($this->isPhpScript($callable)) {
  11775. $className = substr($callable, 0, strpos($callable, '::'));
  11776. $methodName = substr($callable, strpos($callable, '::') + 2);
  11777. if (!class_exists($className)) {
  11778. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  11779. continue;
  11780. }
  11781. if (!is_callable($callable)) {
  11782. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  11783. continue;
  11784. }
  11785. try {
  11786. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  11787. } catch (\Exception $e) {
  11788. $message = "Script %s handling the %s event terminated with an exception";
  11789. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  11790. throw $e;
  11791. }
  11792. } else {
  11793. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  11794. $exec = $callable . ($args === '' ? '' : ' '.$args);
  11795. if ($this->io->isVerbose()) {
  11796. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  11797. } else {
  11798. $this->io->writeError(sprintf('> %s', $exec));
  11799. }
  11800. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  11801. if ($possibleLocalBinaries) {
  11802. foreach ($possibleLocalBinaries as $localExec) {
  11803. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  11804. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  11805. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  11806. break;
  11807. }
  11808. }
  11809. }
  11810. if (substr($exec, 0, 5) === '@php ') {
  11811. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  11812. }
  11813. if (0 !== ($exitCode = $this->process->execute($exec))) {
  11814. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  11815. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  11816. }
  11817. }
  11818. if ($event->isPropagationStopped()) {
  11819. break;
  11820. }
  11821. }
  11822. $this->popEvent();
  11823. return $return;
  11824. }
  11825. protected function getPhpExecCommand()
  11826. {
  11827. $finder = new PhpExecutableFinder();
  11828. $phpPath = $finder->find();
  11829. if (!$phpPath) {
  11830. throw new \RuntimeException('Failed to locate PHP binary to execute '.$scriptName);
  11831. }
  11832. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  11833. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  11834. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  11835. return ProcessExecutor::escape($phpPath) . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  11836. }
  11837. protected function executeEventPhpScript($className, $methodName, Event $event)
  11838. {
  11839. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  11840. if ($this->io->isVerbose()) {
  11841. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  11842. } else {
  11843. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  11844. }
  11845. return $className::$methodName($event);
  11846. }
  11847. protected function checkListenerExpectedEvent($target, Event $event)
  11848. {
  11849. if (in_array($event->getName(), array(
  11850. 'init',
  11851. 'command',
  11852. 'pre-file-download',
  11853. ), true)) {
  11854. return $event;
  11855. }
  11856. try {
  11857. $reflected = new \ReflectionParameter($target, 0);
  11858. } catch (\Exception $e) {
  11859. return $event;
  11860. }
  11861. $typehint = $reflected->getClass();
  11862. if (!$typehint instanceof \ReflectionClass) {
  11863. return $event;
  11864. }
  11865. $expected = $typehint->getName();
  11866. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  11867. 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);
  11868. $event = new \Composer\Script\CommandEvent(
  11869. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(), $event->getArguments()
  11870. );
  11871. }
  11872. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  11873. 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);
  11874. $event = new \Composer\Script\PackageEvent(
  11875. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  11876. $event->getPolicy(), $event->getPool(), $event->getInstalledRepo(), $event->getRequest(),
  11877. $event->getOperations(), $event->getOperation()
  11878. );
  11879. }
  11880. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  11881. 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);
  11882. $event = new \Composer\Script\Event(
  11883. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  11884. $event->getArguments(), $event->getFlags()
  11885. );
  11886. }
  11887. return $event;
  11888. }
  11889. private function serializeCallback($cb)
  11890. {
  11891. if (is_array($cb) && count($cb) === 2) {
  11892. if (is_object($cb[0])) {
  11893. $cb[0] = get_class($cb[0]);
  11894. }
  11895. if (is_string($cb[0]) && is_string($cb[1])) {
  11896. $cb = implode('::', $cb);
  11897. }
  11898. }
  11899. if (is_string($cb)) {
  11900. return $cb;
  11901. }
  11902. return var_export($cb, true);
  11903. }
  11904. public function addListener($eventName, $listener, $priority = 0)
  11905. {
  11906. $this->listeners[$eventName][$priority][] = $listener;
  11907. }
  11908. public function addSubscriber(EventSubscriberInterface $subscriber)
  11909. {
  11910. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  11911. if (is_string($params)) {
  11912. $this->addListener($eventName, array($subscriber, $params));
  11913. } elseif (is_string($params[0])) {
  11914. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  11915. } else {
  11916. foreach ($params as $listener) {
  11917. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  11918. }
  11919. }
  11920. }
  11921. }
  11922. protected function getListeners(Event $event)
  11923. {
  11924. $scriptListeners = $this->getScriptListeners($event);
  11925. if (!isset($this->listeners[$event->getName()][0])) {
  11926. $this->listeners[$event->getName()][0] = array();
  11927. }
  11928. krsort($this->listeners[$event->getName()]);
  11929. $listeners = $this->listeners;
  11930. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  11931. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  11932. }
  11933. public function hasEventListeners(Event $event)
  11934. {
  11935. $listeners = $this->getListeners($event);
  11936. return count($listeners) > 0;
  11937. }
  11938. protected function getScriptListeners(Event $event)
  11939. {
  11940. $package = $this->composer->getPackage();
  11941. $scripts = $package->getScripts();
  11942. if (empty($scripts[$event->getName()])) {
  11943. return array();
  11944. }
  11945. if ($this->loader) {
  11946. $this->loader->unregister();
  11947. }
  11948. $generator = $this->composer->getAutoloadGenerator();
  11949. if ($event instanceof ScriptEvent) {
  11950. $generator->setDevMode($event->isDevMode());
  11951. }
  11952. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  11953. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  11954. $map = $generator->parseAutoloads($packageMap, $package);
  11955. $this->loader = $generator->createLoader($map);
  11956. $this->loader->register();
  11957. return $scripts[$event->getName()];
  11958. }
  11959. protected function isPhpScript($callable)
  11960. {
  11961. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  11962. }
  11963. protected function isComposerScript($callable)
  11964. {
  11965. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5);
  11966. }
  11967. protected function pushEvent(Event $event)
  11968. {
  11969. $eventName = $event->getName();
  11970. if (in_array($eventName, $this->eventStack)) {
  11971. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  11972. }
  11973. return array_push($this->eventStack, $eventName);
  11974. }
  11975. protected function popEvent()
  11976. {
  11977. return array_pop($this->eventStack);
  11978. }
  11979. }
  11980. <?php
  11981. namespace Composer\EventDispatcher;
  11982. interface EventSubscriberInterface
  11983. {
  11984. public static function getSubscribedEvents();
  11985. }
  11986. <?php
  11987. namespace Composer\EventDispatcher;
  11988. class ScriptExecutionException extends \RuntimeException
  11989. {
  11990. }
  11991. <?php
  11992. namespace Composer\Exception;
  11993. class NoSslException extends \RuntimeException
  11994. {
  11995. }
  11996. <?php
  11997. namespace Composer;
  11998. use Composer\Config\JsonConfigSource;
  11999. use Composer\Json\JsonFile;
  12000. use Composer\IO\IOInterface;
  12001. use Composer\Package\Archiver;
  12002. use Composer\Package\Version\VersionGuesser;
  12003. use Composer\Repository\RepositoryManager;
  12004. use Composer\Repository\RepositoryFactory;
  12005. use Composer\Repository\WritableRepositoryInterface;
  12006. use Composer\Util\Filesystem;
  12007. use Composer\Util\Platform;
  12008. use Composer\Util\ProcessExecutor;
  12009. use Composer\Util\RemoteFilesystem;
  12010. use Composer\Util\Silencer;
  12011. use Composer\Plugin\PluginEvents;
  12012. use Composer\EventDispatcher\Event;
  12013. use Seld\JsonLint\DuplicateKeyException;
  12014. use Symfony\Component\Console\Formatter\OutputFormatter;
  12015. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  12016. use Symfony\Component\Console\Output\ConsoleOutput;
  12017. use Composer\EventDispatcher\EventDispatcher;
  12018. use Composer\Autoload\AutoloadGenerator;
  12019. use Composer\Package\Version\VersionParser;
  12020. use Composer\Downloader\TransportException;
  12021. use Seld\JsonLint\JsonParser;
  12022. class Factory
  12023. {
  12024. protected static function getHomeDir()
  12025. {
  12026. $home = getenv('COMPOSER_HOME');
  12027. if ($home) {
  12028. return $home;
  12029. }
  12030. if (Platform::isWindows()) {
  12031. if (!getenv('APPDATA')) {
  12032. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12033. }
  12034. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  12035. }
  12036. $userDir = self::getUserDir();
  12037. if (is_dir($userDir . '/.composer')) {
  12038. return $userDir . '/.composer';
  12039. }
  12040. if (self::useXdg()) {
  12041. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  12042. return $xdgConfig . '/composer';
  12043. }
  12044. return $userDir . '/.composer';
  12045. }
  12046. protected static function getCacheDir($home)
  12047. {
  12048. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  12049. if ($cacheDir) {
  12050. return $cacheDir;
  12051. }
  12052. $homeEnv = getenv('COMPOSER_HOME');
  12053. if ($homeEnv) {
  12054. return $homeEnv . '/cache';
  12055. }
  12056. if (Platform::isWindows()) {
  12057. if ($cacheDir = getenv('LOCALAPPDATA')) {
  12058. $cacheDir .= '/Composer';
  12059. } else {
  12060. $cacheDir = $home . '/cache';
  12061. }
  12062. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  12063. }
  12064. $userDir = self::getUserDir();
  12065. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  12066. return $home . '/cache';
  12067. }
  12068. if (self::useXdg()) {
  12069. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  12070. return $xdgCache . '/composer';
  12071. }
  12072. return $home . '/cache';
  12073. }
  12074. protected static function getDataDir($home)
  12075. {
  12076. $homeEnv = getenv('COMPOSER_HOME');
  12077. if ($homeEnv) {
  12078. return $homeEnv;
  12079. }
  12080. if (Platform::isWindows()) {
  12081. return strtr($home, '\\', '/');
  12082. }
  12083. $userDir = self::getUserDir();
  12084. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  12085. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  12086. return $xdgData . '/composer';
  12087. }
  12088. return $home;
  12089. }
  12090. public static function createConfig(IOInterface $io = null, $cwd = null)
  12091. {
  12092. $cwd = $cwd ?: getcwd();
  12093. $config = new Config(true, $cwd);
  12094. $home = self::getHomeDir();
  12095. $config->merge(array('config' => array(
  12096. 'home' => $home,
  12097. 'cache-dir' => self::getCacheDir($home),
  12098. 'data-dir' => self::getDataDir($home),
  12099. )));
  12100. $htaccessProtect = (bool) $config->get('htaccess-protect');
  12101. if ($htaccessProtect) {
  12102. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  12103. foreach ($dirs as $dir) {
  12104. if (!file_exists($dir . '/.htaccess')) {
  12105. if (!is_dir($dir)) {
  12106. Silencer::call('mkdir', $dir, 0777, true);
  12107. }
  12108. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  12109. }
  12110. }
  12111. }
  12112. $file = new JsonFile($config->get('home').'/config.json');
  12113. if ($file->exists()) {
  12114. if ($io && $io->isDebug()) {
  12115. $io->writeError('Loading config file ' . $file->getPath());
  12116. }
  12117. $config->merge($file->read());
  12118. }
  12119. $config->setConfigSource(new JsonConfigSource($file));
  12120. $file = new JsonFile($config->get('home').'/auth.json');
  12121. if ($file->exists()) {
  12122. if ($io && $io->isDebug()) {
  12123. $io->writeError('Loading config file ' . $file->getPath());
  12124. }
  12125. $config->merge(array('config' => $file->read()));
  12126. }
  12127. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  12128. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  12129. $authData = json_decode($composerAuthEnv, true);
  12130. if (null === $authData) {
  12131. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  12132. }
  12133. if ($io && $io->isDebug()) {
  12134. $io->writeError('Loading auth config from COMPOSER_AUTH');
  12135. }
  12136. $config->merge(array('config' => $authData));
  12137. }
  12138. return $config;
  12139. }
  12140. public static function getComposerFile()
  12141. {
  12142. return trim(getenv('COMPOSER')) ?: './composer.json';
  12143. }
  12144. public static function createAdditionalStyles()
  12145. {
  12146. return array(
  12147. 'highlight' => new OutputFormatterStyle('red'),
  12148. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  12149. );
  12150. }
  12151. public static function createOutput()
  12152. {
  12153. $styles = self::createAdditionalStyles();
  12154. $formatter = new OutputFormatter(false, $styles);
  12155. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  12156. }
  12157. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  12158. {
  12159. return RepositoryFactory::defaultRepos($io, $config, $rm);
  12160. }
  12161. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  12162. {
  12163. $cwd = $cwd ?: getcwd();
  12164. if (null === $localConfig) {
  12165. $localConfig = static::getComposerFile();
  12166. }
  12167. if (is_string($localConfig)) {
  12168. $composerFile = $localConfig;
  12169. $file = new JsonFile($localConfig, null, $io);
  12170. if (!$file->exists()) {
  12171. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  12172. $message = 'Composer could not find a composer.json file in '.$cwd;
  12173. } else {
  12174. $message = 'Composer could not find the config file: '.$localConfig;
  12175. }
  12176. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  12177. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  12178. }
  12179. $file->validateSchema(JsonFile::LAX_SCHEMA);
  12180. $jsonParser = new JsonParser;
  12181. try {
  12182. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  12183. } catch (DuplicateKeyException $e) {
  12184. $details = $e->getDetails();
  12185. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  12186. }
  12187. $localConfig = $file->read();
  12188. }
  12189. $config = static::createConfig($io, $cwd);
  12190. $config->merge($localConfig);
  12191. if (isset($composerFile)) {
  12192. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  12193. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  12194. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  12195. if ($localAuthFile->exists()) {
  12196. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  12197. $config->merge(array('config' => $localAuthFile->read()));
  12198. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  12199. }
  12200. }
  12201. $vendorDir = $config->get('vendor-dir');
  12202. $composer = new Composer();
  12203. $composer->setConfig($config);
  12204. if ($fullLoad) {
  12205. $io->loadConfiguration($config);
  12206. }
  12207. $rfs = self::createRemoteFilesystem($io, $config);
  12208. $dispatcher = new EventDispatcher($composer, $io);
  12209. $composer->setEventDispatcher($dispatcher);
  12210. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  12211. $composer->setRepositoryManager($rm);
  12212. $this->addLocalRepository($io, $rm, $vendorDir);
  12213. if (!$fullLoad && !isset($localConfig['version'])) {
  12214. $localConfig['version'] = '1.0.0';
  12215. }
  12216. $parser = new VersionParser;
  12217. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  12218. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser);
  12219. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  12220. $composer->setPackage($package);
  12221. $im = $this->createInstallationManager();
  12222. $composer->setInstallationManager($im);
  12223. if ($fullLoad) {
  12224. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  12225. $composer->setDownloadManager($dm);
  12226. $generator = new AutoloadGenerator($dispatcher, $io);
  12227. $composer->setAutoloadGenerator($generator);
  12228. $am = $this->createArchiveManager($config, $dm);
  12229. $composer->setArchiveManager($am);
  12230. }
  12231. $this->createDefaultInstallers($im, $composer, $io);
  12232. if ($fullLoad) {
  12233. $globalComposer = null;
  12234. if (realpath($config->get('home')) !== $cwd) {
  12235. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  12236. }
  12237. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  12238. $composer->setPluginManager($pm);
  12239. $pm->loadInstalledPlugins();
  12240. }
  12241. if ($fullLoad && isset($composerFile)) {
  12242. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  12243. ? substr($composerFile, 0, -4).'lock'
  12244. : $composerFile . '.lock';
  12245. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  12246. $composer->setLocker($locker);
  12247. }
  12248. if ($fullLoad) {
  12249. $initEvent = new Event(PluginEvents::INIT);
  12250. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  12251. if ($rm->getLocalRepository()) {
  12252. $this->purgePackages($rm->getLocalRepository(), $im);
  12253. }
  12254. }
  12255. return $composer;
  12256. }
  12257. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  12258. {
  12259. $factory = new static();
  12260. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  12261. }
  12262. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  12263. {
  12264. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  12265. }
  12266. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  12267. {
  12268. $composer = null;
  12269. try {
  12270. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  12271. } catch (\Exception $e) {
  12272. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  12273. }
  12274. return $composer;
  12275. }
  12276. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  12277. {
  12278. $cache = null;
  12279. if ($config->get('cache-files-ttl') > 0) {
  12280. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  12281. }
  12282. $dm = new Downloader\DownloadManager($io);
  12283. switch ($preferred = $config->get('preferred-install')) {
  12284. case 'dist':
  12285. $dm->setPreferDist(true);
  12286. break;
  12287. case 'source':
  12288. $dm->setPreferSource(true);
  12289. break;
  12290. case 'auto':
  12291. default:
  12292. break;
  12293. }
  12294. if (is_array($preferred)) {
  12295. $dm->setPreferences($preferred);
  12296. }
  12297. $executor = new ProcessExecutor($io);
  12298. $fs = new Filesystem($executor);
  12299. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  12300. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  12301. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  12302. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  12303. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  12304. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12305. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12306. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12307. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12308. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12309. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12310. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12311. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12312. return $dm;
  12313. }
  12314. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  12315. {
  12316. if (null === $dm) {
  12317. $io = new IO\NullIO();
  12318. $io->loadConfiguration($config);
  12319. $dm = $this->createDownloadManager($io, $config);
  12320. }
  12321. $am = new Archiver\ArchiveManager($dm);
  12322. $am->addArchiver(new Archiver\ZipArchiver);
  12323. $am->addArchiver(new Archiver\PharArchiver);
  12324. return $am;
  12325. }
  12326. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  12327. {
  12328. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  12329. }
  12330. protected function createInstallationManager()
  12331. {
  12332. return new Installer\InstallationManager();
  12333. }
  12334. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  12335. {
  12336. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  12337. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  12338. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  12339. $im->addInstaller(new Installer\MetapackageInstaller());
  12340. }
  12341. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  12342. {
  12343. foreach ($repo->getPackages() as $package) {
  12344. if (!$im->isPackageInstalled($repo, $package)) {
  12345. $repo->removePackage($package);
  12346. }
  12347. }
  12348. }
  12349. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  12350. {
  12351. $factory = new static();
  12352. return $factory->createComposer($io, $config, $disablePlugins);
  12353. }
  12354. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  12355. {
  12356. static $warned = false;
  12357. $disableTls = false;
  12358. if ($config && $config->get('disable-tls') === true) {
  12359. if (!$warned) {
  12360. $io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  12361. }
  12362. $warned = true;
  12363. $disableTls = true;
  12364. } elseif (!extension_loaded('openssl')) {
  12365. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  12366. . '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.');
  12367. }
  12368. $remoteFilesystemOptions = array();
  12369. if ($disableTls === false) {
  12370. if ($config && $config->get('cafile')) {
  12371. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  12372. }
  12373. if ($config && $config->get('capath')) {
  12374. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  12375. }
  12376. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  12377. }
  12378. try {
  12379. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  12380. } catch (TransportException $e) {
  12381. if (false !== strpos($e->getMessage(), 'cafile')) {
  12382. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  12383. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  12384. if (PHP_VERSION_ID < 50600) {
  12385. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  12386. }
  12387. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  12388. }
  12389. throw $e;
  12390. }
  12391. return $remoteFilesystem;
  12392. }
  12393. private static function useXdg()
  12394. {
  12395. foreach (array_keys($_SERVER) as $key) {
  12396. if (substr($key, 0, 4) === 'XDG_') {
  12397. return true;
  12398. }
  12399. }
  12400. return false;
  12401. }
  12402. private static function getUserDir()
  12403. {
  12404. $home = getenv('HOME');
  12405. if (!$home) {
  12406. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12407. }
  12408. return rtrim(strtr($home, '\\', '/'), '/');
  12409. }
  12410. }
  12411. <?php
  12412. namespace Composer\IO;
  12413. use Composer\Config;
  12414. use Composer\Util\ProcessExecutor;
  12415. use Psr\Log\LoggerInterface;
  12416. use Psr\Log\LogLevel;
  12417. abstract class BaseIO implements IOInterface, LoggerInterface
  12418. {
  12419. protected $authentications = array();
  12420. public function getAuthentications()
  12421. {
  12422. return $this->authentications;
  12423. }
  12424. public function hasAuthentication($repositoryName)
  12425. {
  12426. return isset($this->authentications[$repositoryName]);
  12427. }
  12428. public function getAuthentication($repositoryName)
  12429. {
  12430. if (isset($this->authentications[$repositoryName])) {
  12431. return $this->authentications[$repositoryName];
  12432. }
  12433. return array('username' => null, 'password' => null);
  12434. }
  12435. public function setAuthentication($repositoryName, $username, $password = null)
  12436. {
  12437. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  12438. }
  12439. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  12440. {
  12441. if ($this->hasAuthentication($repositoryName)) {
  12442. $auth = $this->getAuthentication($repositoryName);
  12443. if ($auth['username'] === $username && $auth['password'] === $password) {
  12444. return;
  12445. }
  12446. $this->writeError(
  12447. sprintf(
  12448. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  12449. $repositoryName
  12450. )
  12451. );
  12452. }
  12453. $this->setAuthentication($repositoryName, $username, $password);
  12454. }
  12455. public function loadConfiguration(Config $config)
  12456. {
  12457. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  12458. $githubOauth = $config->get('github-oauth') ?: array();
  12459. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  12460. $gitlabToken = $config->get('gitlab-token') ?: array();
  12461. $httpBasic = $config->get('http-basic') ?: array();
  12462. foreach ($bitbucketOauth as $domain => $cred) {
  12463. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  12464. }
  12465. foreach ($githubOauth as $domain => $token) {
  12466. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  12467. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  12468. }
  12469. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  12470. }
  12471. foreach ($gitlabOauth as $domain => $token) {
  12472. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  12473. }
  12474. foreach ($gitlabToken as $domain => $token) {
  12475. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  12476. }
  12477. foreach ($httpBasic as $domain => $cred) {
  12478. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  12479. }
  12480. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  12481. }
  12482. public function emergency($message, array $context = array())
  12483. {
  12484. return $this->log(LogLevel::EMERGENCY, $message, $context);
  12485. }
  12486. public function alert($message, array $context = array())
  12487. {
  12488. return $this->log(LogLevel::ALERT, $message, $context);
  12489. }
  12490. public function critical($message, array $context = array())
  12491. {
  12492. return $this->log(LogLevel::CRITICAL, $message, $context);
  12493. }
  12494. public function error($message, array $context = array())
  12495. {
  12496. return $this->log(LogLevel::ERROR, $message, $context);
  12497. }
  12498. public function warning($message, array $context = array())
  12499. {
  12500. return $this->log(LogLevel::WARNING, $message, $context);
  12501. }
  12502. public function notice($message, array $context = array())
  12503. {
  12504. return $this->log(LogLevel::NOTICE, $message, $context);
  12505. }
  12506. public function info($message, array $context = array())
  12507. {
  12508. return $this->log(LogLevel::INFO, $message, $context);
  12509. }
  12510. public function debug($message, array $context = array())
  12511. {
  12512. return $this->log(LogLevel::DEBUG, $message, $context);
  12513. }
  12514. public function log($level, $message, array $context = array())
  12515. {
  12516. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  12517. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  12518. } elseif ($level === LogLevel::WARNING) {
  12519. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  12520. } elseif ($level === LogLevel::NOTICE) {
  12521. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  12522. } elseif ($level === LogLevel::INFO) {
  12523. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  12524. } else {
  12525. $this->writeError($message, true, self::DEBUG);
  12526. }
  12527. }
  12528. }
  12529. <?php
  12530. namespace Composer\IO;
  12531. use Symfony\Component\Console\Output\StreamOutput;
  12532. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  12533. use Symfony\Component\Console\Input\StringInput;
  12534. use Symfony\Component\Console\Helper\HelperSet;
  12535. class BufferIO extends ConsoleIO
  12536. {
  12537. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  12538. {
  12539. $input = new StringInput($input);
  12540. $input->setInteractive(false);
  12541. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  12542. parent::__construct($input, $output, new HelperSet(array()));
  12543. }
  12544. public function getOutput()
  12545. {
  12546. fseek($this->output->getStream(), 0);
  12547. $output = stream_get_contents($this->output->getStream());
  12548. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  12549. $pre = strip_tags($matches[1]);
  12550. if (strlen($pre) === strlen($matches[2])) {
  12551. return '';
  12552. }
  12553. return rtrim($matches[1])."\n";
  12554. }, $output);
  12555. return $output;
  12556. }
  12557. }
  12558. <?php
  12559. namespace Composer\IO;
  12560. use Composer\Question\StrictConfirmationQuestion;
  12561. use Symfony\Component\Console\Helper\HelperSet;
  12562. use Symfony\Component\Console\Input\InputInterface;
  12563. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  12564. use Symfony\Component\Console\Output\OutputInterface;
  12565. use Symfony\Component\Console\Question\ChoiceQuestion;
  12566. use Symfony\Component\Console\Question\Question;
  12567. class ConsoleIO extends BaseIO
  12568. {
  12569. protected $input;
  12570. protected $output;
  12571. protected $helperSet;
  12572. protected $lastMessage;
  12573. protected $lastMessageErr;
  12574. private $startTime;
  12575. private $verbosityMap;
  12576. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  12577. {
  12578. $this->input = $input;
  12579. $this->output = $output;
  12580. $this->helperSet = $helperSet;
  12581. $this->verbosityMap = array(
  12582. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  12583. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  12584. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  12585. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  12586. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  12587. );
  12588. }
  12589. public function enableDebugging($startTime)
  12590. {
  12591. $this->startTime = $startTime;
  12592. }
  12593. public function isInteractive()
  12594. {
  12595. return $this->input->isInteractive();
  12596. }
  12597. public function isDecorated()
  12598. {
  12599. return $this->output->isDecorated();
  12600. }
  12601. public function isVerbose()
  12602. {
  12603. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  12604. }
  12605. public function isVeryVerbose()
  12606. {
  12607. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  12608. }
  12609. public function isDebug()
  12610. {
  12611. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  12612. }
  12613. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  12614. {
  12615. $this->doWrite($messages, $newline, false, $verbosity);
  12616. }
  12617. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  12618. {
  12619. $this->doWrite($messages, $newline, true, $verbosity);
  12620. }
  12621. private function doWrite($messages, $newline, $stderr, $verbosity)
  12622. {
  12623. $sfVerbosity = $this->verbosityMap[$verbosity];
  12624. if ($sfVerbosity > $this->output->getVerbosity()) {
  12625. return;
  12626. }
  12627. if (OutputInterface::VERBOSITY_QUIET === 0) {
  12628. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  12629. }
  12630. if (null !== $this->startTime) {
  12631. $memoryUsage = memory_get_usage() / 1024 / 1024;
  12632. $timeSpent = microtime(true) - $this->startTime;
  12633. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  12634. return sprintf('[%.1fMB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  12635. }, (array) $messages);
  12636. }
  12637. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  12638. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  12639. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  12640. return;
  12641. }
  12642. $this->output->write($messages, $newline, $sfVerbosity);
  12643. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  12644. }
  12645. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  12646. {
  12647. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  12648. }
  12649. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  12650. {
  12651. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  12652. }
  12653. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  12654. {
  12655. $messages = implode($newline ? "\n" : '', (array) $messages);
  12656. if (!isset($size)) {
  12657. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  12658. }
  12659. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  12660. $this->doWrite($messages, false, $stderr, $verbosity);
  12661. $fill = $size - strlen(strip_tags($messages));
  12662. if ($fill > 0) {
  12663. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  12664. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  12665. }
  12666. if ($newline) {
  12667. $this->doWrite('', true, $stderr, $verbosity);
  12668. }
  12669. if ($stderr) {
  12670. $this->lastMessageErr = $messages;
  12671. } else {
  12672. $this->lastMessage = $messages;
  12673. }
  12674. }
  12675. public function ask($question, $default = null)
  12676. {
  12677. $helper = $this->helperSet->get('question');
  12678. $question = new Question($question, $default);
  12679. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12680. }
  12681. public function askConfirmation($question, $default = true)
  12682. {
  12683. $helper = $this->helperSet->get('question');
  12684. $question = new StrictConfirmationQuestion($question, $default);
  12685. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12686. }
  12687. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  12688. {
  12689. $helper = $this->helperSet->get('question');
  12690. $question = new Question($question, $default);
  12691. $question->setValidator($validator);
  12692. $question->setMaxAttempts($attempts);
  12693. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12694. }
  12695. public function askAndHideAnswer($question)
  12696. {
  12697. $this->writeError($question, false);
  12698. return \Seld\CliPrompt\CliPrompt::hiddenPrompt(true);
  12699. }
  12700. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  12701. {
  12702. $helper = $this->helperSet->get('question');
  12703. $question = new ChoiceQuestion($question, $choices, $default);
  12704. $question->setMaxAttempts($attempts ?: null);
  12705. $question->setErrorMessage($errorMessage);
  12706. $question->setMultiselect($multiselect);
  12707. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  12708. $results = array();
  12709. foreach ($choices as $index => $choice) {
  12710. if (in_array($choice, $result, true)) {
  12711. $results[] = (string) $index;
  12712. }
  12713. }
  12714. return $results;
  12715. }
  12716. private function getErrorOutput()
  12717. {
  12718. if ($this->output instanceof ConsoleOutputInterface) {
  12719. return $this->output->getErrorOutput();
  12720. }
  12721. return $this->output;
  12722. }
  12723. }
  12724. <?php
  12725. namespace Composer\IO;
  12726. use Composer\Config;
  12727. interface IOInterface
  12728. {
  12729. const QUIET = 1;
  12730. const NORMAL = 2;
  12731. const VERBOSE = 4;
  12732. const VERY_VERBOSE = 8;
  12733. const DEBUG = 16;
  12734. public function isInteractive();
  12735. public function isVerbose();
  12736. public function isVeryVerbose();
  12737. public function isDebug();
  12738. public function isDecorated();
  12739. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  12740. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  12741. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  12742. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  12743. public function ask($question, $default = null);
  12744. public function askConfirmation($question, $default = true);
  12745. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  12746. public function askAndHideAnswer($question);
  12747. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  12748. public function getAuthentications();
  12749. public function hasAuthentication($repositoryName);
  12750. public function getAuthentication($repositoryName);
  12751. public function setAuthentication($repositoryName, $username, $password = null);
  12752. public function loadConfiguration(Config $config);
  12753. }
  12754. <?php
  12755. namespace Composer\IO;
  12756. class NullIO extends BaseIO
  12757. {
  12758. public function isInteractive()
  12759. {
  12760. return false;
  12761. }
  12762. public function isVerbose()
  12763. {
  12764. return false;
  12765. }
  12766. public function isVeryVerbose()
  12767. {
  12768. return false;
  12769. }
  12770. public function isDebug()
  12771. {
  12772. return false;
  12773. }
  12774. public function isDecorated()
  12775. {
  12776. return false;
  12777. }
  12778. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  12779. {
  12780. }
  12781. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  12782. {
  12783. }
  12784. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  12785. {
  12786. }
  12787. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  12788. {
  12789. }
  12790. public function ask($question, $default = null)
  12791. {
  12792. return $default;
  12793. }
  12794. public function askConfirmation($question, $default = true)
  12795. {
  12796. return $default;
  12797. }
  12798. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  12799. {
  12800. return $default;
  12801. }
  12802. public function askAndHideAnswer($question)
  12803. {
  12804. return null;
  12805. }
  12806. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  12807. {
  12808. return $default;
  12809. }
  12810. }
  12811. <?php
  12812. namespace Composer;
  12813. use Composer\Autoload\AutoloadGenerator;
  12814. use Composer\DependencyResolver\DefaultPolicy;
  12815. use Composer\DependencyResolver\Operation\UpdateOperation;
  12816. use Composer\DependencyResolver\Operation\InstallOperation;
  12817. use Composer\DependencyResolver\Operation\UninstallOperation;
  12818. use Composer\DependencyResolver\Operation\OperationInterface;
  12819. use Composer\DependencyResolver\PolicyInterface;
  12820. use Composer\DependencyResolver\Pool;
  12821. use Composer\DependencyResolver\Request;
  12822. use Composer\DependencyResolver\Rule;
  12823. use Composer\DependencyResolver\Solver;
  12824. use Composer\DependencyResolver\SolverProblemsException;
  12825. use Composer\Downloader\DownloadManager;
  12826. use Composer\EventDispatcher\EventDispatcher;
  12827. use Composer\Installer\InstallationManager;
  12828. use Composer\Installer\InstallerEvents;
  12829. use Composer\Installer\NoopInstaller;
  12830. use Composer\Installer\SuggestedPackagesReporter;
  12831. use Composer\IO\IOInterface;
  12832. use Composer\Package\AliasPackage;
  12833. use Composer\Package\CompletePackage;
  12834. use Composer\Package\Link;
  12835. use Composer\Package\Loader\ArrayLoader;
  12836. use Composer\Package\Dumper\ArrayDumper;
  12837. use Composer\Semver\Constraint\Constraint;
  12838. use Composer\Package\Locker;
  12839. use Composer\Package\PackageInterface;
  12840. use Composer\Package\RootPackageInterface;
  12841. use Composer\Repository\CompositeRepository;
  12842. use Composer\Repository\InstalledArrayRepository;
  12843. use Composer\Repository\PlatformRepository;
  12844. use Composer\Repository\RepositoryInterface;
  12845. use Composer\Repository\RepositoryManager;
  12846. use Composer\Repository\WritableRepositoryInterface;
  12847. use Composer\Script\ScriptEvents;
  12848. class Installer
  12849. {
  12850. protected $io;
  12851. protected $config;
  12852. protected $package;
  12853. protected $downloadManager;
  12854. protected $repositoryManager;
  12855. protected $locker;
  12856. protected $installationManager;
  12857. protected $eventDispatcher;
  12858. protected $autoloadGenerator;
  12859. protected $preferSource = false;
  12860. protected $preferDist = false;
  12861. protected $optimizeAutoloader = false;
  12862. protected $classMapAuthoritative = false;
  12863. protected $apcuAutoloader = false;
  12864. protected $devMode = false;
  12865. protected $dryRun = false;
  12866. protected $verbose = false;
  12867. protected $update = false;
  12868. protected $dumpAutoloader = true;
  12869. protected $runScripts = true;
  12870. protected $ignorePlatformReqs = false;
  12871. protected $preferStable = false;
  12872. protected $preferLowest = false;
  12873. protected $skipSuggest = false;
  12874. protected $writeLock = true;
  12875. protected $executeOperations = true;
  12876. protected $updateWhitelist = null;
  12877. protected $whitelistDependencies = false;
  12878. protected $whitelistAllDependencies = false;
  12879. protected $suggestedPackagesReporter;
  12880. protected $additionalInstalledRepository;
  12881. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  12882. {
  12883. $this->io = $io;
  12884. $this->config = $config;
  12885. $this->package = $package;
  12886. $this->downloadManager = $downloadManager;
  12887. $this->repositoryManager = $repositoryManager;
  12888. $this->locker = $locker;
  12889. $this->installationManager = $installationManager;
  12890. $this->eventDispatcher = $eventDispatcher;
  12891. $this->autoloadGenerator = $autoloadGenerator;
  12892. }
  12893. public function run()
  12894. {
  12895. gc_collect_cycles();
  12896. gc_disable();
  12897. if (!$this->update && !$this->locker->isLocked()) {
  12898. $this->update = true;
  12899. }
  12900. if ($this->dryRun) {
  12901. $this->verbose = true;
  12902. $this->runScripts = false;
  12903. $this->executeOperations = false;
  12904. $this->writeLock = false;
  12905. $this->dumpAutoloader = false;
  12906. $this->installationManager->addInstaller(new NoopInstaller);
  12907. $this->mockLocalRepositories($this->repositoryManager);
  12908. }
  12909. if ($this->runScripts) {
  12910. $devMode = (int) $this->devMode;
  12911. putenv("COMPOSER_DEV_MODE=$devMode");
  12912. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  12913. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  12914. }
  12915. $this->downloadManager->setPreferSource($this->preferSource);
  12916. $this->downloadManager->setPreferDist($this->preferDist);
  12917. $localRepo = $this->repositoryManager->getLocalRepository();
  12918. if ($this->update) {
  12919. $platformOverrides = $this->config->get('platform') ?: array();
  12920. } else {
  12921. $platformOverrides = $this->locker->getPlatformOverrides();
  12922. }
  12923. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  12924. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  12925. $aliases = $this->getRootAliases();
  12926. $this->aliasPlatformPackages($platformRepo, $aliases);
  12927. if (!$this->suggestedPackagesReporter) {
  12928. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  12929. }
  12930. try {
  12931. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  12932. if ($res !== 0) {
  12933. return $res;
  12934. }
  12935. } catch (\Exception $e) {
  12936. if ($this->executeOperations) {
  12937. $this->installationManager->notifyInstalls($this->io);
  12938. }
  12939. throw $e;
  12940. }
  12941. if ($this->executeOperations) {
  12942. $this->installationManager->notifyInstalls($this->io);
  12943. }
  12944. if ($this->devMode && !$this->skipSuggest) {
  12945. $this->suggestedPackagesReporter->output($installedRepo);
  12946. }
  12947. foreach ($localRepo->getPackages() as $package) {
  12948. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  12949. continue;
  12950. }
  12951. $replacement = (is_string($package->getReplacementPackage()))
  12952. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  12953. : 'No replacement was suggested';
  12954. $this->io->writeError(
  12955. sprintf(
  12956. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  12957. $package->getPrettyName(),
  12958. $replacement
  12959. )
  12960. );
  12961. }
  12962. if ($this->update && $this->writeLock) {
  12963. $localRepo->reload();
  12964. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  12965. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  12966. $updatedLock = $this->locker->setLockData(
  12967. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  12968. $devPackages,
  12969. $platformReqs,
  12970. $platformDevReqs,
  12971. $aliases,
  12972. $this->package->getMinimumStability(),
  12973. $this->package->getStabilityFlags(),
  12974. $this->preferStable || $this->package->getPreferStable(),
  12975. $this->preferLowest,
  12976. $this->config->get('platform') ?: array()
  12977. );
  12978. if ($updatedLock) {
  12979. $this->io->writeError('<info>Writing lock file</info>');
  12980. }
  12981. }
  12982. if ($this->dumpAutoloader) {
  12983. if ($this->optimizeAutoloader) {
  12984. $this->io->writeError('<info>Generating optimized autoload files</info>');
  12985. } else {
  12986. $this->io->writeError('<info>Generating autoload files</info>');
  12987. }
  12988. $this->autoloadGenerator->setDevMode($this->devMode);
  12989. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  12990. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  12991. $this->autoloadGenerator->setRunScripts($this->runScripts);
  12992. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  12993. }
  12994. if ($this->executeOperations) {
  12995. foreach ($localRepo->getPackages() as $package) {
  12996. $this->installationManager->ensureBinariesPresence($package);
  12997. }
  12998. $vendorDir = $this->config->get('vendor-dir');
  12999. if (is_dir($vendorDir)) {
  13000. @touch($vendorDir);
  13001. }
  13002. }
  13003. if ($this->runScripts) {
  13004. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  13005. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13006. }
  13007. if (!defined('HHVM_VERSION')) {
  13008. gc_enable();
  13009. }
  13010. return 0;
  13011. }
  13012. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  13013. {
  13014. $lockedRepository = null;
  13015. $repositories = null;
  13016. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  13017. try {
  13018. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  13019. } catch (\RuntimeException $e) {
  13020. if ($this->package->getDevRequires()) {
  13021. throw $e;
  13022. }
  13023. $lockedRepository = $this->locker->getLockedRepository();
  13024. }
  13025. }
  13026. $this->whitelistUpdateDependencies(
  13027. $lockedRepository ?: $localRepo,
  13028. $this->package->getRequires(),
  13029. $this->package->getDevRequires()
  13030. );
  13031. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  13032. $policy = $this->createPolicy();
  13033. $pool = $this->createPool($this->update ? null : $lockedRepository);
  13034. $pool->addRepository($installedRepo, $aliases);
  13035. if ($this->update) {
  13036. $repositories = $this->repositoryManager->getRepositories();
  13037. foreach ($repositories as $repository) {
  13038. $pool->addRepository($repository, $aliases);
  13039. }
  13040. }
  13041. if ($lockedRepository) {
  13042. $pool->addRepository($lockedRepository, $aliases);
  13043. }
  13044. $request = $this->createRequest($this->package, $platformRepo);
  13045. if ($this->update) {
  13046. $removedUnstablePackages = array();
  13047. foreach ($localRepo->getPackages() as $package) {
  13048. if (
  13049. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  13050. && $this->installationManager->isPackageInstalled($localRepo, $package)
  13051. ) {
  13052. $removedUnstablePackages[$package->getName()] = true;
  13053. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  13054. }
  13055. }
  13056. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  13057. $request->updateAll();
  13058. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13059. foreach ($links as $link) {
  13060. $request->install($link->getTarget(), $link->getConstraint());
  13061. }
  13062. if ($this->updateWhitelist) {
  13063. $currentPackages = $this->getCurrentPackages($installedRepo);
  13064. $candidates = array();
  13065. foreach ($links as $link) {
  13066. $candidates[$link->getTarget()] = true;
  13067. $rootRequires[$link->getTarget()] = $link;
  13068. }
  13069. foreach ($currentPackages as $package) {
  13070. $candidates[$package->getName()] = true;
  13071. }
  13072. foreach ($candidates as $candidate => $dummy) {
  13073. foreach ($currentPackages as $curPackage) {
  13074. if ($curPackage->getName() === $candidate) {
  13075. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  13076. $constraint = new Constraint('=', $curPackage->getVersion());
  13077. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  13078. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  13079. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  13080. $request->install($curPackage->getName(), $constraint);
  13081. }
  13082. break;
  13083. }
  13084. }
  13085. }
  13086. }
  13087. } else {
  13088. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  13089. if (!$this->locker->isFresh()) {
  13090. $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);
  13091. }
  13092. foreach ($lockedRepository->getPackages() as $package) {
  13093. $version = $package->getVersion();
  13094. if (isset($aliases[$package->getName()][$version])) {
  13095. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  13096. }
  13097. $constraint = new Constraint('=', $version);
  13098. $constraint->setPrettyString($package->getPrettyVersion());
  13099. $request->install($package->getName(), $constraint);
  13100. }
  13101. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  13102. $request->install($link->getTarget(), $link->getConstraint());
  13103. }
  13104. }
  13105. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  13106. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  13107. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13108. try {
  13109. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  13110. } catch (SolverProblemsException $e) {
  13111. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  13112. $this->io->writeError($e->getMessage());
  13113. if ($this->update && !$this->devMode) {
  13114. $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);
  13115. }
  13116. return array(max(1, $e->getCode()), array());
  13117. }
  13118. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  13119. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  13120. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  13121. $this->io->writeError("Analyzed ".$solver->getRuleSetSize()." rules to resolve dependencies", true, IOInterface::VERBOSE);
  13122. if (!$operations) {
  13123. $this->io->writeError('Nothing to install or update');
  13124. }
  13125. $operations = $this->movePluginsToFront($operations);
  13126. $operations = $this->moveUninstallsToFront($operations);
  13127. if ($this->update) {
  13128. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  13129. if (!$this->devMode) {
  13130. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  13131. }
  13132. } else {
  13133. $devPackages = null;
  13134. }
  13135. if ($operations) {
  13136. $installs = $updates = $uninstalls = array();
  13137. foreach ($operations as $operation) {
  13138. if ($operation instanceof InstallOperation) {
  13139. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  13140. } elseif ($operation instanceof UpdateOperation) {
  13141. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  13142. } elseif ($operation instanceof UninstallOperation) {
  13143. $uninstalls[] = $operation->getPackage()->getPrettyName();
  13144. }
  13145. }
  13146. $this->io->writeError(
  13147. sprintf("<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  13148. count($installs),
  13149. 1 === count($installs) ? '' : 's',
  13150. count($updates),
  13151. 1 === count($updates) ? '' : 's',
  13152. count($uninstalls),
  13153. 1 === count($uninstalls) ? '' : 's')
  13154. );
  13155. if ($installs) {
  13156. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  13157. }
  13158. if ($updates) {
  13159. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  13160. }
  13161. if ($uninstalls) {
  13162. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  13163. }
  13164. }
  13165. foreach ($operations as $operation) {
  13166. if ('install' === $operation->getJobType()) {
  13167. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  13168. }
  13169. if ($this->update) {
  13170. $package = null;
  13171. if ('update' === $operation->getJobType()) {
  13172. $package = $operation->getTargetPackage();
  13173. } elseif ('install' === $operation->getJobType()) {
  13174. $package = $operation->getPackage();
  13175. }
  13176. if ($package && $package->isDev()) {
  13177. $references = $this->package->getReferences();
  13178. if (isset($references[$package->getName()])) {
  13179. $this->updateInstallReferences($package, $references[$package->getName()]);
  13180. }
  13181. }
  13182. if ('update' === $operation->getJobType()
  13183. && $operation->getTargetPackage()->isDev()
  13184. && $operation->getTargetPackage()->getVersion() === $operation->getInitialPackage()->getVersion()
  13185. && (!$operation->getTargetPackage()->getSourceReference() || $operation->getTargetPackage()->getSourceReference() === $operation->getInitialPackage()->getSourceReference())
  13186. && (!$operation->getTargetPackage()->getDistReference() || $operation->getTargetPackage()->getDistReference() === $operation->getInitialPackage()->getDistReference())
  13187. ) {
  13188. $this->io->writeError(' - Skipping update of '. $operation->getTargetPackage()->getPrettyName().' to the same reference-locked version', true, IOInterface::DEBUG);
  13189. $this->io->writeError('', true, IOInterface::DEBUG);
  13190. continue;
  13191. }
  13192. }
  13193. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($operation->getJobType());
  13194. if (defined($event) && $this->runScripts) {
  13195. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13196. }
  13197. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  13198. $this->io->writeError(' - ' . $operation);
  13199. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  13200. $this->io->writeError(' - ' . $operation);
  13201. }
  13202. $this->installationManager->execute($localRepo, $operation);
  13203. if ($this->verbose && $this->io->isVeryVerbose() && in_array($operation->getJobType(), array('install', 'update'))) {
  13204. $reason = $operation->getReason();
  13205. if ($reason instanceof Rule) {
  13206. switch ($reason->getReason()) {
  13207. case Rule::RULE_JOB_INSTALL:
  13208. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  13209. $this->io->writeError('');
  13210. break;
  13211. case Rule::RULE_PACKAGE_REQUIRES:
  13212. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  13213. $this->io->writeError('');
  13214. break;
  13215. }
  13216. }
  13217. }
  13218. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($operation->getJobType());
  13219. if (defined($event) && $this->runScripts) {
  13220. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13221. }
  13222. if ($this->executeOperations || $this->writeLock) {
  13223. $localRepo->write();
  13224. }
  13225. }
  13226. if ($this->executeOperations) {
  13227. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  13228. $localRepo->write();
  13229. }
  13230. return array(0, $devPackages);
  13231. }
  13232. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  13233. {
  13234. if (!$this->package->getDevRequires()) {
  13235. return array();
  13236. }
  13237. $tempLocalRepo = clone $localRepo;
  13238. foreach ($operations as $operation) {
  13239. switch ($operation->getJobType()) {
  13240. case 'install':
  13241. case 'markAliasInstalled':
  13242. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  13243. $tempLocalRepo->addPackage(clone $operation->getPackage());
  13244. }
  13245. break;
  13246. case 'uninstall':
  13247. case 'markAliasUninstalled':
  13248. $tempLocalRepo->removePackage($operation->getPackage());
  13249. break;
  13250. case 'update':
  13251. $tempLocalRepo->removePackage($operation->getInitialPackage());
  13252. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  13253. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  13254. }
  13255. break;
  13256. default:
  13257. throw new \LogicException('Unknown type: '.$operation->getJobType());
  13258. }
  13259. }
  13260. $localRepo = new InstalledArrayRepository(array());
  13261. $loader = new ArrayLoader(null, true);
  13262. $dumper = new ArrayDumper();
  13263. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  13264. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  13265. }
  13266. unset($tempLocalRepo, $loader, $dumper);
  13267. $policy = $this->createPolicy();
  13268. $pool = $this->createPool();
  13269. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13270. $pool->addRepository($installedRepo, $aliases);
  13271. $request = $this->createRequest($this->package, $platformRepo);
  13272. $request->updateAll();
  13273. foreach ($this->package->getRequires() as $link) {
  13274. $request->install($link->getTarget(), $link->getConstraint());
  13275. }
  13276. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  13277. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13278. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  13279. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  13280. $devPackages = array();
  13281. foreach ($ops as $op) {
  13282. if ($op->getJobType() === 'uninstall') {
  13283. $devPackages[] = $op->getPackage();
  13284. }
  13285. }
  13286. return $devPackages;
  13287. }
  13288. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  13289. {
  13290. $finalOps = array();
  13291. $packagesToSkip = array();
  13292. foreach ($devPackages as $pkg) {
  13293. $packagesToSkip[$pkg->getName()] = true;
  13294. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  13295. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  13296. }
  13297. }
  13298. foreach ($operations as $op) {
  13299. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  13300. if (isset($packagesToSkip[$package->getName()])) {
  13301. continue;
  13302. }
  13303. $finalOps[] = $op;
  13304. }
  13305. return $finalOps;
  13306. }
  13307. private function movePluginsToFront(array $operations)
  13308. {
  13309. $pluginsNoDeps = array();
  13310. $pluginsWithDeps = array();
  13311. $pluginRequires = array();
  13312. foreach (array_reverse($operations, true) as $idx => $op) {
  13313. if ($op instanceof InstallOperation) {
  13314. $package = $op->getPackage();
  13315. } elseif ($op instanceof UpdateOperation) {
  13316. $package = $op->getTargetPackage();
  13317. } else {
  13318. continue;
  13319. }
  13320. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  13321. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  13322. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  13323. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  13324. });
  13325. if ($isPlugin && !count($requires)) {
  13326. array_unshift($pluginsNoDeps, $op);
  13327. } else {
  13328. $pluginRequires = array_merge($pluginRequires, $requires);
  13329. array_unshift($pluginsWithDeps, $op);
  13330. }
  13331. unset($operations[$idx]);
  13332. }
  13333. }
  13334. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  13335. }
  13336. private function moveUninstallsToFront(array $operations)
  13337. {
  13338. $uninstOps = array();
  13339. foreach ($operations as $idx => $op) {
  13340. if ($op instanceof UninstallOperation) {
  13341. $uninstOps[] = $op;
  13342. unset($operations[$idx]);
  13343. }
  13344. }
  13345. return array_merge($uninstOps, $operations);
  13346. }
  13347. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  13348. {
  13349. $installedRootPackage = clone $this->package;
  13350. $installedRootPackage->setRequires(array());
  13351. $installedRootPackage->setDevRequires(array());
  13352. $repos = array(
  13353. $localRepo,
  13354. new InstalledArrayRepository(array($installedRootPackage)),
  13355. $platformRepo,
  13356. );
  13357. $installedRepo = new CompositeRepository($repos);
  13358. if ($this->additionalInstalledRepository) {
  13359. $installedRepo->addRepository($this->additionalInstalledRepository);
  13360. }
  13361. return $installedRepo;
  13362. }
  13363. private function createPool(RepositoryInterface $lockedRepository = null)
  13364. {
  13365. if ($this->update) {
  13366. $minimumStability = $this->package->getMinimumStability();
  13367. $stabilityFlags = $this->package->getStabilityFlags();
  13368. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13369. } else {
  13370. $minimumStability = $this->locker->getMinimumStability();
  13371. $stabilityFlags = $this->locker->getStabilityFlags();
  13372. $requires = array();
  13373. foreach ($lockedRepository->getPackages() as $package) {
  13374. $constraint = new Constraint('=', $package->getVersion());
  13375. $constraint->setPrettyString($package->getPrettyVersion());
  13376. $requires[$package->getName()] = $constraint;
  13377. }
  13378. }
  13379. $rootConstraints = array();
  13380. foreach ($requires as $req => $constraint) {
  13381. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  13382. continue;
  13383. }
  13384. if ($constraint instanceof Link) {
  13385. $rootConstraints[$req] = $constraint->getConstraint();
  13386. } else {
  13387. $rootConstraints[$req] = $constraint;
  13388. }
  13389. }
  13390. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  13391. }
  13392. private function createPolicy()
  13393. {
  13394. $preferStable = null;
  13395. $preferLowest = null;
  13396. if (!$this->update) {
  13397. $preferStable = $this->locker->getPreferStable();
  13398. $preferLowest = $this->locker->getPreferLowest();
  13399. }
  13400. if (null === $preferStable) {
  13401. $preferStable = $this->preferStable || $this->package->getPreferStable();
  13402. }
  13403. if (null === $preferLowest) {
  13404. $preferLowest = $this->preferLowest;
  13405. }
  13406. return new DefaultPolicy($preferStable, $preferLowest);
  13407. }
  13408. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  13409. {
  13410. $request = new Request();
  13411. $constraint = new Constraint('=', $rootPackage->getVersion());
  13412. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  13413. $request->install($rootPackage->getName(), $constraint);
  13414. $fixedPackages = $platformRepo->getPackages();
  13415. if ($this->additionalInstalledRepository) {
  13416. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  13417. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  13418. }
  13419. $provided = $rootPackage->getProvides();
  13420. foreach ($fixedPackages as $package) {
  13421. $constraint = new Constraint('=', $package->getVersion());
  13422. $constraint->setPrettyString($package->getPrettyVersion());
  13423. if ($package->getRepository() !== $platformRepo
  13424. || !isset($provided[$package->getName()])
  13425. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  13426. ) {
  13427. $request->fix($package->getName(), $constraint);
  13428. }
  13429. }
  13430. return $request;
  13431. }
  13432. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  13433. {
  13434. if ($task === 'force-updates' && null === $operations) {
  13435. throw new \InvalidArgumentException('Missing operations argument');
  13436. }
  13437. if ($task === 'force-links') {
  13438. $operations = array();
  13439. }
  13440. if ($this->update && $this->updateWhitelist) {
  13441. $currentPackages = $this->getCurrentPackages($installedRepo);
  13442. }
  13443. foreach ($localRepo->getCanonicalPackages() as $package) {
  13444. if (!$package->isDev()) {
  13445. continue;
  13446. }
  13447. foreach ($operations as $operation) {
  13448. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  13449. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  13450. ) {
  13451. continue 2;
  13452. }
  13453. }
  13454. if ($this->update) {
  13455. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13456. foreach ($currentPackages as $curPackage) {
  13457. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  13458. if ($task === 'force-links') {
  13459. $package->setRequires($curPackage->getRequires());
  13460. $package->setConflicts($curPackage->getConflicts());
  13461. $package->setProvides($curPackage->getProvides());
  13462. $package->setReplaces($curPackage->getReplaces());
  13463. } elseif ($task === 'force-updates') {
  13464. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  13465. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  13466. ) {
  13467. $operations[] = new UpdateOperation($package, $curPackage);
  13468. }
  13469. }
  13470. break;
  13471. }
  13472. }
  13473. continue;
  13474. }
  13475. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13476. foreach ($matches as $index => $match) {
  13477. if (!in_array($match->getRepository(), $repositories, true)) {
  13478. unset($matches[$index]);
  13479. continue;
  13480. }
  13481. if ($match->getName() !== $package->getName()) {
  13482. unset($matches[$index]);
  13483. continue;
  13484. }
  13485. $matches[$index] = $match->getId();
  13486. }
  13487. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13488. $newPackage = $pool->literalToPackage($matches[0]);
  13489. if ($task === 'force-links' && $newPackage) {
  13490. $package->setRequires($newPackage->getRequires());
  13491. $package->setConflicts($newPackage->getConflicts());
  13492. $package->setProvides($newPackage->getProvides());
  13493. $package->setReplaces($newPackage->getReplaces());
  13494. }
  13495. if ($task === 'force-updates' && $newPackage && (
  13496. (($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  13497. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  13498. )
  13499. )) {
  13500. $operations[] = new UpdateOperation($package, $newPackage);
  13501. continue;
  13502. }
  13503. }
  13504. if ($task === 'force-updates') {
  13505. $references = $this->package->getReferences();
  13506. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  13507. $operations[] = new UpdateOperation($package, clone $package);
  13508. }
  13509. }
  13510. } else {
  13511. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  13512. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  13513. if ($task === 'force-links') {
  13514. $package->setRequires($lockedPackage->getRequires());
  13515. $package->setConflicts($lockedPackage->getConflicts());
  13516. $package->setProvides($lockedPackage->getProvides());
  13517. $package->setReplaces($lockedPackage->getReplaces());
  13518. } elseif ($task === 'force-updates') {
  13519. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  13520. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  13521. ) {
  13522. $operations[] = new UpdateOperation($package, $lockedPackage);
  13523. }
  13524. }
  13525. break;
  13526. }
  13527. }
  13528. }
  13529. }
  13530. return $operations;
  13531. }
  13532. private function getCurrentPackages($installedRepo)
  13533. {
  13534. if ($this->locker->isLocked()) {
  13535. try {
  13536. return $this->locker->getLockedRepository(true)->getPackages();
  13537. } catch (\RuntimeException $e) {
  13538. return $this->locker->getLockedRepository()->getPackages();
  13539. }
  13540. }
  13541. return $installedRepo->getPackages();
  13542. }
  13543. private function getRootAliases()
  13544. {
  13545. if ($this->update) {
  13546. $aliases = $this->package->getAliases();
  13547. } else {
  13548. $aliases = $this->locker->getAliases();
  13549. }
  13550. $normalizedAliases = array();
  13551. foreach ($aliases as $alias) {
  13552. $normalizedAliases[$alias['package']][$alias['version']] = array(
  13553. 'alias' => $alias['alias'],
  13554. 'alias_normalized' => $alias['alias_normalized'],
  13555. );
  13556. }
  13557. return $normalizedAliases;
  13558. }
  13559. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  13560. {
  13561. if (!$this->update) {
  13562. return;
  13563. }
  13564. $rootRefs = $this->package->getReferences();
  13565. foreach ($localRepo->getCanonicalPackages() as $package) {
  13566. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13567. foreach ($matches as $index => $match) {
  13568. if (!in_array($match->getRepository(), $repositories, true)) {
  13569. unset($matches[$index]);
  13570. continue;
  13571. }
  13572. if ($match->getName() !== $package->getName()) {
  13573. unset($matches[$index]);
  13574. continue;
  13575. }
  13576. $matches[$index] = $match->getId();
  13577. }
  13578. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13579. $newPackage = $pool->literalToPackage($matches[0]);
  13580. $sourceUrl = $package->getSourceUrl();
  13581. $newSourceUrl = $newPackage->getSourceUrl();
  13582. $newReference = $newPackage->getSourceReference();
  13583. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  13584. $newReference = $rootRefs[$package->getName()];
  13585. }
  13586. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl());
  13587. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  13588. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  13589. }
  13590. $package->setDistMirrors($newPackage->getDistMirrors());
  13591. $package->setSourceMirrors($newPackage->getSourceMirrors());
  13592. }
  13593. }
  13594. }
  13595. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl)
  13596. {
  13597. $oldSourceRef = $package->getSourceReference();
  13598. if ($package->getSourceUrl() !== $sourceUrl) {
  13599. $package->setSourceType($sourceType);
  13600. $package->setSourceUrl($sourceUrl);
  13601. $package->setSourceReference($sourceReference);
  13602. }
  13603. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $distUrl)) {
  13604. $package->setDistUrl($distUrl);
  13605. $this->updateInstallReferences($package, $sourceReference);
  13606. }
  13607. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13608. $this->updateInstallReferences($package, $oldSourceRef);
  13609. }
  13610. }
  13611. private function updateInstallReferences(PackageInterface $package, $reference)
  13612. {
  13613. if (!$reference) {
  13614. return;
  13615. }
  13616. $package->setSourceReference($reference);
  13617. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $package->getDistUrl())) {
  13618. $package->setDistReference($reference);
  13619. $package->setDistUrl(preg_replace('{(?<=/)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  13620. } elseif ($package->getDistReference()) {
  13621. $package->setDistReference($reference);
  13622. }
  13623. }
  13624. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  13625. {
  13626. foreach ($aliases as $package => $versions) {
  13627. foreach ($versions as $version => $alias) {
  13628. $packages = $platformRepo->findPackages($package, $version);
  13629. foreach ($packages as $package) {
  13630. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  13631. $aliasPackage->setRootPackageAlias(true);
  13632. $platformRepo->addPackage($aliasPackage);
  13633. }
  13634. }
  13635. }
  13636. }
  13637. private function isUpdateable(PackageInterface $package)
  13638. {
  13639. if (!$this->updateWhitelist) {
  13640. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  13641. }
  13642. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  13643. $patternRegexp = $this->packageNameToRegexp($whiteListedPattern);
  13644. if (preg_match($patternRegexp, $package->getName())) {
  13645. return true;
  13646. }
  13647. }
  13648. return false;
  13649. }
  13650. private function packageNameToRegexp($whiteListedPattern)
  13651. {
  13652. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  13653. return "{^" . $cleanedWhiteListedPattern . "$}i";
  13654. }
  13655. private function extractPlatformRequirements($links)
  13656. {
  13657. $platformReqs = array();
  13658. foreach ($links as $link) {
  13659. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  13660. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  13661. }
  13662. }
  13663. return $platformReqs;
  13664. }
  13665. private function whitelistUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  13666. {
  13667. if (!$this->updateWhitelist) {
  13668. return;
  13669. }
  13670. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  13671. $requiredPackageNames = array();
  13672. foreach ($rootRequires as $require) {
  13673. $requiredPackageNames[] = $require->getTarget();
  13674. }
  13675. $skipPackages = array();
  13676. if (!$this->whitelistAllDependencies) {
  13677. foreach ($rootRequires as $require) {
  13678. $skipPackages[$require->getTarget()] = true;
  13679. }
  13680. }
  13681. $pool = new Pool('dev');
  13682. $pool->addRepository($localOrLockRepo);
  13683. $seen = array();
  13684. $rootRequiredPackageNames = array_keys($rootRequires);
  13685. foreach ($this->updateWhitelist as $packageName => $void) {
  13686. $packageQueue = new \SplQueue;
  13687. $depPackages = $pool->whatProvides($packageName);
  13688. $nameMatchesRequiredPackage = in_array($packageName, $requiredPackageNames, true);
  13689. if (!$nameMatchesRequiredPackage) {
  13690. $whitelistPatternRegexp = $this->packageNameToRegexp($packageName);
  13691. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  13692. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  13693. $nameMatchesRequiredPackage = true;
  13694. break;
  13695. }
  13696. }
  13697. }
  13698. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  13699. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  13700. }
  13701. foreach ($depPackages as $depPackage) {
  13702. $packageQueue->enqueue($depPackage);
  13703. }
  13704. while (!$packageQueue->isEmpty()) {
  13705. $package = $packageQueue->dequeue();
  13706. if (isset($seen[$package->getId()])) {
  13707. continue;
  13708. }
  13709. $seen[$package->getId()] = true;
  13710. $this->updateWhitelist[$package->getName()] = true;
  13711. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  13712. continue;
  13713. }
  13714. $requires = $package->getRequires();
  13715. foreach ($requires as $require) {
  13716. $requirePackages = $pool->whatProvides($require->getTarget());
  13717. foreach ($requirePackages as $requirePackage) {
  13718. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  13719. continue;
  13720. }
  13721. if (isset($skipPackages[$requirePackage->getName()])) {
  13722. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  13723. continue;
  13724. }
  13725. $packageQueue->enqueue($requirePackage);
  13726. }
  13727. }
  13728. }
  13729. }
  13730. }
  13731. private function mockLocalRepositories(RepositoryManager $rm)
  13732. {
  13733. $packages = array();
  13734. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  13735. $packages[(string) $package] = clone $package;
  13736. }
  13737. foreach ($packages as $key => $package) {
  13738. if ($package instanceof AliasPackage) {
  13739. $alias = (string) $package->getAliasOf();
  13740. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  13741. }
  13742. }
  13743. $rm->setLocalRepository(
  13744. new InstalledArrayRepository($packages)
  13745. );
  13746. }
  13747. public static function create(IOInterface $io, Composer $composer)
  13748. {
  13749. return new static(
  13750. $io,
  13751. $composer->getConfig(),
  13752. $composer->getPackage(),
  13753. $composer->getDownloadManager(),
  13754. $composer->getRepositoryManager(),
  13755. $composer->getLocker(),
  13756. $composer->getInstallationManager(),
  13757. $composer->getEventDispatcher(),
  13758. $composer->getAutoloadGenerator()
  13759. );
  13760. }
  13761. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  13762. {
  13763. $this->additionalInstalledRepository = $additionalInstalledRepository;
  13764. return $this;
  13765. }
  13766. public function setDryRun($dryRun = true)
  13767. {
  13768. $this->dryRun = (bool) $dryRun;
  13769. return $this;
  13770. }
  13771. public function isDryRun()
  13772. {
  13773. return $this->dryRun;
  13774. }
  13775. public function setPreferSource($preferSource = true)
  13776. {
  13777. $this->preferSource = (bool) $preferSource;
  13778. return $this;
  13779. }
  13780. public function setPreferDist($preferDist = true)
  13781. {
  13782. $this->preferDist = (bool) $preferDist;
  13783. return $this;
  13784. }
  13785. public function setOptimizeAutoloader($optimizeAutoloader = false)
  13786. {
  13787. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  13788. if (!$this->optimizeAutoloader) {
  13789. $this->setClassMapAuthoritative(false);
  13790. }
  13791. return $this;
  13792. }
  13793. public function setClassMapAuthoritative($classMapAuthoritative = false)
  13794. {
  13795. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  13796. if ($this->classMapAuthoritative) {
  13797. $this->setOptimizeAutoloader(true);
  13798. }
  13799. return $this;
  13800. }
  13801. public function setApcuAutoloader($apcuAutoloader = false)
  13802. {
  13803. $this->apcuAutoloader = (bool) $apcuAutoloader;
  13804. return $this;
  13805. }
  13806. public function setUpdate($update = true)
  13807. {
  13808. $this->update = (bool) $update;
  13809. return $this;
  13810. }
  13811. public function setDevMode($devMode = true)
  13812. {
  13813. $this->devMode = (bool) $devMode;
  13814. return $this;
  13815. }
  13816. public function setDumpAutoloader($dumpAutoloader = true)
  13817. {
  13818. $this->dumpAutoloader = (bool) $dumpAutoloader;
  13819. return $this;
  13820. }
  13821. public function setRunScripts($runScripts = true)
  13822. {
  13823. $this->runScripts = (bool) $runScripts;
  13824. return $this;
  13825. }
  13826. public function setConfig(Config $config)
  13827. {
  13828. $this->config = $config;
  13829. return $this;
  13830. }
  13831. public function setVerbose($verbose = true)
  13832. {
  13833. $this->verbose = (bool) $verbose;
  13834. return $this;
  13835. }
  13836. public function isVerbose()
  13837. {
  13838. return $this->verbose;
  13839. }
  13840. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  13841. {
  13842. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  13843. return $this;
  13844. }
  13845. public function setUpdateWhitelist(array $packages)
  13846. {
  13847. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  13848. return $this;
  13849. }
  13850. public function setWhitelistDependencies($updateDependencies = true)
  13851. {
  13852. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  13853. }
  13854. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  13855. {
  13856. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  13857. return $this;
  13858. }
  13859. public function setWhitelistAllDependencies($updateAllDependencies = true)
  13860. {
  13861. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  13862. return $this;
  13863. }
  13864. public function setPreferStable($preferStable = true)
  13865. {
  13866. $this->preferStable = (bool) $preferStable;
  13867. return $this;
  13868. }
  13869. public function setPreferLowest($preferLowest = true)
  13870. {
  13871. $this->preferLowest = (bool) $preferLowest;
  13872. return $this;
  13873. }
  13874. public function setWriteLock($writeLock = true)
  13875. {
  13876. $this->writeLock = (bool) $writeLock;
  13877. return $this;
  13878. }
  13879. public function setExecuteOperations($executeOperations = true)
  13880. {
  13881. $this->executeOperations = (bool) $executeOperations;
  13882. return $this;
  13883. }
  13884. public function setSkipSuggest($skipSuggest = true)
  13885. {
  13886. $this->skipSuggest = (bool) $skipSuggest;
  13887. return $this;
  13888. }
  13889. public function disablePlugins()
  13890. {
  13891. $this->installationManager->disablePlugins();
  13892. return $this;
  13893. }
  13894. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  13895. {
  13896. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  13897. return $this;
  13898. }
  13899. }
  13900. <?php
  13901. namespace Composer\Installer;
  13902. use Composer\IO\IOInterface;
  13903. use Composer\Package\PackageInterface;
  13904. use Composer\Util\Filesystem;
  13905. use Composer\Util\Platform;
  13906. use Composer\Util\ProcessExecutor;
  13907. use Composer\Util\Silencer;
  13908. class BinaryInstaller
  13909. {
  13910. protected $binDir;
  13911. protected $binCompat;
  13912. protected $io;
  13913. protected $filesystem;
  13914. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  13915. {
  13916. $this->binDir = $binDir;
  13917. $this->binCompat = $binCompat;
  13918. $this->io = $io;
  13919. $this->filesystem = $filesystem ?: new Filesystem();
  13920. }
  13921. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  13922. {
  13923. $binaries = $this->getBinaries($package);
  13924. if (!$binaries) {
  13925. return;
  13926. }
  13927. foreach ($binaries as $bin) {
  13928. $binPath = $installPath.'/'.$bin;
  13929. if (!file_exists($binPath)) {
  13930. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  13931. continue;
  13932. }
  13933. $binPath = realpath($binPath);
  13934. $this->initializeBinDir();
  13935. $link = $this->binDir.'/'.basename($bin);
  13936. if (file_exists($link)) {
  13937. if (is_link($link)) {
  13938. Silencer::call('chmod', $link, 0777 & ~umask());
  13939. }
  13940. if ($warnOnOverwrite) {
  13941. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  13942. }
  13943. continue;
  13944. }
  13945. if ($this->binCompat === "auto") {
  13946. if (Platform::isWindows()) {
  13947. $this->installFullBinaries($binPath, $link, $bin, $package);
  13948. } else {
  13949. $this->installSymlinkBinaries($binPath, $link);
  13950. }
  13951. } elseif ($this->binCompat === "full") {
  13952. $this->installFullBinaries($binPath, $link, $bin, $package);
  13953. }
  13954. Silencer::call('chmod', $link, 0777 & ~umask());
  13955. }
  13956. }
  13957. public function removeBinaries(PackageInterface $package)
  13958. {
  13959. $this->initializeBinDir();
  13960. $binaries = $this->getBinaries($package);
  13961. if (!$binaries) {
  13962. return;
  13963. }
  13964. foreach ($binaries as $bin) {
  13965. $link = $this->binDir.'/'.basename($bin);
  13966. if (is_link($link) || file_exists($link)) {
  13967. $this->filesystem->unlink($link);
  13968. }
  13969. if (file_exists($link.'.bat')) {
  13970. $this->filesystem->unlink($link.'.bat');
  13971. }
  13972. }
  13973. if ((is_dir($this->binDir)) && ($this->filesystem->isDirEmpty($this->binDir))) {
  13974. Silencer::call('rmdir', $this->binDir);
  13975. }
  13976. }
  13977. public static function determineBinaryCaller($bin)
  13978. {
  13979. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  13980. return 'call';
  13981. }
  13982. $handle = fopen($bin, 'r');
  13983. $line = fgets($handle);
  13984. fclose($handle);
  13985. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  13986. return trim($match[1]);
  13987. }
  13988. return 'php';
  13989. }
  13990. protected function getBinaries(PackageInterface $package)
  13991. {
  13992. return $package->getBinaries();
  13993. }
  13994. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  13995. {
  13996. if ('.bat' !== substr($binPath, -4)) {
  13997. $this->installUnixyProxyBinaries($binPath, $link);
  13998. @chmod($link, 0777 & ~umask());
  13999. $link .= '.bat';
  14000. if (file_exists($link)) {
  14001. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  14002. }
  14003. }
  14004. if (!file_exists($link)) {
  14005. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  14006. }
  14007. }
  14008. protected function installSymlinkBinaries($binPath, $link)
  14009. {
  14010. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  14011. $this->installUnixyProxyBinaries($binPath, $link);
  14012. }
  14013. }
  14014. protected function installUnixyProxyBinaries($binPath, $link)
  14015. {
  14016. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  14017. }
  14018. protected function initializeBinDir()
  14019. {
  14020. $this->filesystem->ensureDirectoryExists($this->binDir);
  14021. $this->binDir = realpath($this->binDir);
  14022. }
  14023. protected function generateWindowsProxyCode($bin, $link)
  14024. {
  14025. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14026. $caller = self::determineBinaryCaller($bin);
  14027. return "@ECHO OFF\r\n".
  14028. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  14029. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  14030. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  14031. }
  14032. protected function generateUnixyProxyCode($bin, $link)
  14033. {
  14034. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14035. $binDir = ProcessExecutor::escape(dirname($binPath));
  14036. $binFile = basename($binPath);
  14037. $proxyCode = <<<PROXY
  14038. #!/usr/bin/env sh
  14039. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  14040. if [ -d /proc/cygdrive ] && [[ \$(which php) == \$(readlink -n /proc/cygdrive)/* ]]; then
  14041. # We are in Cgywin using Windows php, so the path must be translated
  14042. dir=\$(cygpath -m "\$dir");
  14043. fi
  14044. "\${dir}/$binFile" "\$@"
  14045. PROXY;
  14046. return $proxyCode;
  14047. }
  14048. }
  14049. <?php
  14050. namespace Composer\Installer;
  14051. use Composer\Package\PackageInterface;
  14052. interface BinaryPresenceInterface
  14053. {
  14054. public function ensureBinariesPresence(PackageInterface $package);
  14055. }
  14056. <?php
  14057. namespace Composer\Installer;
  14058. use Composer\IO\IOInterface;
  14059. use Composer\Package\PackageInterface;
  14060. use Composer\Package\AliasPackage;
  14061. use Composer\Repository\RepositoryInterface;
  14062. use Composer\Repository\InstalledRepositoryInterface;
  14063. use Composer\DependencyResolver\Operation\OperationInterface;
  14064. use Composer\DependencyResolver\Operation\InstallOperation;
  14065. use Composer\DependencyResolver\Operation\UpdateOperation;
  14066. use Composer\DependencyResolver\Operation\UninstallOperation;
  14067. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  14068. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14069. use Composer\Util\StreamContextFactory;
  14070. class InstallationManager
  14071. {
  14072. private $installers = array();
  14073. private $cache = array();
  14074. private $notifiablePackages = array();
  14075. public function reset()
  14076. {
  14077. $this->notifiablePackages = array();
  14078. }
  14079. public function addInstaller(InstallerInterface $installer)
  14080. {
  14081. array_unshift($this->installers, $installer);
  14082. $this->cache = array();
  14083. }
  14084. public function removeInstaller(InstallerInterface $installer)
  14085. {
  14086. if (false !== ($key = array_search($installer, $this->installers, true))) {
  14087. array_splice($this->installers, $key, 1);
  14088. $this->cache = array();
  14089. }
  14090. }
  14091. public function disablePlugins()
  14092. {
  14093. foreach ($this->installers as $i => $installer) {
  14094. if (!$installer instanceof PluginInstaller) {
  14095. continue;
  14096. }
  14097. unset($this->installers[$i]);
  14098. }
  14099. }
  14100. public function getInstaller($type)
  14101. {
  14102. $type = strtolower($type);
  14103. if (isset($this->cache[$type])) {
  14104. return $this->cache[$type];
  14105. }
  14106. foreach ($this->installers as $installer) {
  14107. if ($installer->supports($type)) {
  14108. return $this->cache[$type] = $installer;
  14109. }
  14110. }
  14111. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  14112. }
  14113. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14114. {
  14115. if ($package instanceof AliasPackage) {
  14116. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  14117. }
  14118. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  14119. }
  14120. public function ensureBinariesPresence(PackageInterface $package)
  14121. {
  14122. try {
  14123. $installer = $this->getInstaller($package->getType());
  14124. } catch (\InvalidArgumentException $e) {
  14125. return;
  14126. }
  14127. if ($installer instanceof BinaryPresenceInterface) {
  14128. $installer->ensureBinariesPresence($package);
  14129. }
  14130. }
  14131. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  14132. {
  14133. $method = $operation->getJobType();
  14134. $this->$method($repo, $operation);
  14135. }
  14136. public function install(RepositoryInterface $repo, InstallOperation $operation)
  14137. {
  14138. $package = $operation->getPackage();
  14139. $installer = $this->getInstaller($package->getType());
  14140. $installer->install($repo, $package);
  14141. $this->markForNotification($package);
  14142. }
  14143. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  14144. {
  14145. $initial = $operation->getInitialPackage();
  14146. $target = $operation->getTargetPackage();
  14147. $initialType = $initial->getType();
  14148. $targetType = $target->getType();
  14149. if ($initialType === $targetType) {
  14150. $installer = $this->getInstaller($initialType);
  14151. $installer->update($repo, $initial, $target);
  14152. $this->markForNotification($target);
  14153. } else {
  14154. $this->getInstaller($initialType)->uninstall($repo, $initial);
  14155. $this->getInstaller($targetType)->install($repo, $target);
  14156. }
  14157. }
  14158. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  14159. {
  14160. $package = $operation->getPackage();
  14161. $installer = $this->getInstaller($package->getType());
  14162. $installer->uninstall($repo, $package);
  14163. }
  14164. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  14165. {
  14166. $package = $operation->getPackage();
  14167. if (!$repo->hasPackage($package)) {
  14168. $repo->addPackage(clone $package);
  14169. }
  14170. }
  14171. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  14172. {
  14173. $package = $operation->getPackage();
  14174. $repo->removePackage($package);
  14175. }
  14176. public function getInstallPath(PackageInterface $package)
  14177. {
  14178. $installer = $this->getInstaller($package->getType());
  14179. return $installer->getInstallPath($package);
  14180. }
  14181. public function notifyInstalls(IOInterface $io)
  14182. {
  14183. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  14184. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  14185. if ($io->hasAuthentication($repositoryName)) {
  14186. $auth = $io->getAuthentication($repositoryName);
  14187. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  14188. $authHeader = 'Authorization: Basic '.$authStr;
  14189. }
  14190. if (strpos($repoUrl, '%package%')) {
  14191. foreach ($packages as $package) {
  14192. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  14193. $params = array(
  14194. 'version' => $package->getPrettyVersion(),
  14195. 'version_normalized' => $package->getVersion(),
  14196. );
  14197. $opts = array('http' =>
  14198. array(
  14199. 'method' => 'POST',
  14200. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  14201. 'content' => http_build_query($params, '', '&'),
  14202. 'timeout' => 3,
  14203. ),
  14204. );
  14205. if (isset($authHeader)) {
  14206. $opts['http']['header'][] = $authHeader;
  14207. }
  14208. $context = StreamContextFactory::getContext($url, $opts);
  14209. @file_get_contents($url, false, $context);
  14210. }
  14211. continue;
  14212. }
  14213. $postData = array('downloads' => array());
  14214. foreach ($packages as $package) {
  14215. $postData['downloads'][] = array(
  14216. 'name' => $package->getPrettyName(),
  14217. 'version' => $package->getVersion(),
  14218. );
  14219. }
  14220. $opts = array('http' =>
  14221. array(
  14222. 'method' => 'POST',
  14223. 'header' => array('Content-Type: application/json'),
  14224. 'content' => json_encode($postData),
  14225. 'timeout' => 6,
  14226. ),
  14227. );
  14228. if (isset($authHeader)) {
  14229. $opts['http']['header'][] = $authHeader;
  14230. }
  14231. $context = StreamContextFactory::getContext($repoUrl, $opts);
  14232. @file_get_contents($repoUrl, false, $context);
  14233. }
  14234. $this->reset();
  14235. }
  14236. private function markForNotification(PackageInterface $package)
  14237. {
  14238. if ($package->getNotificationUrl()) {
  14239. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  14240. }
  14241. }
  14242. }
  14243. <?php
  14244. namespace Composer\Installer;
  14245. use Composer\Composer;
  14246. use Composer\DependencyResolver\PolicyInterface;
  14247. use Composer\DependencyResolver\Operation\OperationInterface;
  14248. use Composer\DependencyResolver\Pool;
  14249. use Composer\DependencyResolver\Request;
  14250. use Composer\EventDispatcher\Event;
  14251. use Composer\IO\IOInterface;
  14252. use Composer\Repository\CompositeRepository;
  14253. class InstallerEvent extends Event
  14254. {
  14255. private $composer;
  14256. private $io;
  14257. private $devMode;
  14258. private $policy;
  14259. private $pool;
  14260. private $installedRepo;
  14261. private $request;
  14262. private $operations;
  14263. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  14264. {
  14265. parent::__construct($eventName);
  14266. $this->composer = $composer;
  14267. $this->io = $io;
  14268. $this->devMode = $devMode;
  14269. $this->policy = $policy;
  14270. $this->pool = $pool;
  14271. $this->installedRepo = $installedRepo;
  14272. $this->request = $request;
  14273. $this->operations = $operations;
  14274. }
  14275. public function getComposer()
  14276. {
  14277. return $this->composer;
  14278. }
  14279. public function getIO()
  14280. {
  14281. return $this->io;
  14282. }
  14283. public function isDevMode()
  14284. {
  14285. return $this->devMode;
  14286. }
  14287. public function getPolicy()
  14288. {
  14289. return $this->policy;
  14290. }
  14291. public function getPool()
  14292. {
  14293. return $this->pool;
  14294. }
  14295. public function getInstalledRepo()
  14296. {
  14297. return $this->installedRepo;
  14298. }
  14299. public function getRequest()
  14300. {
  14301. return $this->request;
  14302. }
  14303. public function getOperations()
  14304. {
  14305. return $this->operations;
  14306. }
  14307. }
  14308. <?php
  14309. namespace Composer\Installer;
  14310. class InstallerEvents
  14311. {
  14312. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  14313. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  14314. }
  14315. <?php
  14316. namespace Composer\Installer;
  14317. use Composer\Package\PackageInterface;
  14318. use Composer\Repository\InstalledRepositoryInterface;
  14319. use InvalidArgumentException;
  14320. interface InstallerInterface
  14321. {
  14322. public function supports($packageType);
  14323. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  14324. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  14325. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  14326. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  14327. public function getInstallPath(PackageInterface $package);
  14328. }
  14329. <?php
  14330. namespace Composer\Installer;
  14331. use Composer\Composer;
  14332. use Composer\IO\IOInterface;
  14333. use Composer\Repository\InstalledRepositoryInterface;
  14334. use Composer\Package\PackageInterface;
  14335. use Composer\Util\Filesystem;
  14336. use Composer\Util\Silencer;
  14337. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  14338. {
  14339. protected $composer;
  14340. protected $vendorDir;
  14341. protected $binDir;
  14342. protected $downloadManager;
  14343. protected $io;
  14344. protected $type;
  14345. protected $filesystem;
  14346. protected $binCompat;
  14347. protected $binaryInstaller;
  14348. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  14349. {
  14350. $this->composer = $composer;
  14351. $this->downloadManager = $composer->getDownloadManager();
  14352. $this->io = $io;
  14353. $this->type = $type;
  14354. $this->filesystem = $filesystem ?: new Filesystem();
  14355. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  14356. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  14357. }
  14358. public function supports($packageType)
  14359. {
  14360. return $packageType === $this->type || null === $this->type;
  14361. }
  14362. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14363. {
  14364. return $repo->hasPackage($package) && is_readable($this->getInstallPath($package));
  14365. }
  14366. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14367. {
  14368. $this->initializeVendorDir();
  14369. $downloadPath = $this->getInstallPath($package);
  14370. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  14371. $this->binaryInstaller->removeBinaries($package);
  14372. }
  14373. $this->installCode($package);
  14374. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  14375. if (!$repo->hasPackage($package)) {
  14376. $repo->addPackage(clone $package);
  14377. }
  14378. }
  14379. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14380. {
  14381. if (!$repo->hasPackage($initial)) {
  14382. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14383. }
  14384. $this->initializeVendorDir();
  14385. $this->binaryInstaller->removeBinaries($initial);
  14386. $this->updateCode($initial, $target);
  14387. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  14388. $repo->removePackage($initial);
  14389. if (!$repo->hasPackage($target)) {
  14390. $repo->addPackage(clone $target);
  14391. }
  14392. }
  14393. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14394. {
  14395. if (!$repo->hasPackage($package)) {
  14396. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14397. }
  14398. $this->removeCode($package);
  14399. $this->binaryInstaller->removeBinaries($package);
  14400. $repo->removePackage($package);
  14401. $downloadPath = $this->getPackageBasePath($package);
  14402. if (strpos($package->getName(), '/')) {
  14403. $packageVendorDir = dirname($downloadPath);
  14404. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  14405. Silencer::call('rmdir', $packageVendorDir);
  14406. }
  14407. }
  14408. }
  14409. public function getInstallPath(PackageInterface $package)
  14410. {
  14411. $this->initializeVendorDir();
  14412. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  14413. $targetDir = $package->getTargetDir();
  14414. return $basePath . ($targetDir ? '/'.$targetDir : '');
  14415. }
  14416. public function ensureBinariesPresence(PackageInterface $package)
  14417. {
  14418. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  14419. }
  14420. protected function getPackageBasePath(PackageInterface $package)
  14421. {
  14422. $installPath = $this->getInstallPath($package);
  14423. $targetDir = $package->getTargetDir();
  14424. if ($targetDir) {
  14425. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  14426. }
  14427. return $installPath;
  14428. }
  14429. protected function installCode(PackageInterface $package)
  14430. {
  14431. $downloadPath = $this->getInstallPath($package);
  14432. $this->downloadManager->download($package, $downloadPath);
  14433. }
  14434. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  14435. {
  14436. $initialDownloadPath = $this->getInstallPath($initial);
  14437. $targetDownloadPath = $this->getInstallPath($target);
  14438. if ($targetDownloadPath !== $initialDownloadPath) {
  14439. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  14440. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  14441. ) {
  14442. $this->removeCode($initial);
  14443. $this->installCode($target);
  14444. return;
  14445. }
  14446. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  14447. }
  14448. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  14449. }
  14450. protected function removeCode(PackageInterface $package)
  14451. {
  14452. $downloadPath = $this->getPackageBasePath($package);
  14453. $this->downloadManager->remove($package, $downloadPath);
  14454. }
  14455. protected function initializeVendorDir()
  14456. {
  14457. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  14458. $this->vendorDir = realpath($this->vendorDir);
  14459. }
  14460. }
  14461. <?php
  14462. namespace Composer\Installer;
  14463. use Composer\Repository\InstalledRepositoryInterface;
  14464. use Composer\Package\PackageInterface;
  14465. class MetapackageInstaller implements InstallerInterface
  14466. {
  14467. public function supports($packageType)
  14468. {
  14469. return $packageType === 'metapackage';
  14470. }
  14471. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14472. {
  14473. return $repo->hasPackage($package);
  14474. }
  14475. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14476. {
  14477. $repo->addPackage(clone $package);
  14478. }
  14479. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14480. {
  14481. if (!$repo->hasPackage($initial)) {
  14482. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14483. }
  14484. $repo->removePackage($initial);
  14485. $repo->addPackage(clone $target);
  14486. }
  14487. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14488. {
  14489. if (!$repo->hasPackage($package)) {
  14490. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14491. }
  14492. $repo->removePackage($package);
  14493. }
  14494. public function getInstallPath(PackageInterface $package)
  14495. {
  14496. return '';
  14497. }
  14498. }
  14499. <?php
  14500. namespace Composer\Installer;
  14501. use Composer\Repository\InstalledRepositoryInterface;
  14502. use Composer\Package\PackageInterface;
  14503. class NoopInstaller implements InstallerInterface
  14504. {
  14505. public function supports($packageType)
  14506. {
  14507. return true;
  14508. }
  14509. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14510. {
  14511. return $repo->hasPackage($package);
  14512. }
  14513. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14514. {
  14515. if (!$repo->hasPackage($package)) {
  14516. $repo->addPackage(clone $package);
  14517. }
  14518. }
  14519. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14520. {
  14521. if (!$repo->hasPackage($initial)) {
  14522. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14523. }
  14524. $repo->removePackage($initial);
  14525. if (!$repo->hasPackage($target)) {
  14526. $repo->addPackage(clone $target);
  14527. }
  14528. }
  14529. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14530. {
  14531. if (!$repo->hasPackage($package)) {
  14532. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14533. }
  14534. $repo->removePackage($package);
  14535. }
  14536. public function getInstallPath(PackageInterface $package)
  14537. {
  14538. $targetDir = $package->getTargetDir();
  14539. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  14540. }
  14541. }
  14542. <?php
  14543. namespace Composer\Installer;
  14544. use Composer\Composer;
  14545. use Composer\IO\IOInterface;
  14546. use Composer\DependencyResolver\Operation\OperationInterface;
  14547. use Composer\DependencyResolver\PolicyInterface;
  14548. use Composer\DependencyResolver\Pool;
  14549. use Composer\DependencyResolver\Request;
  14550. use Composer\Repository\CompositeRepository;
  14551. class PackageEvent extends InstallerEvent
  14552. {
  14553. private $operation;
  14554. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  14555. {
  14556. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  14557. $this->operation = $operation;
  14558. }
  14559. public function getOperation()
  14560. {
  14561. return $this->operation;
  14562. }
  14563. }
  14564. <?php
  14565. namespace Composer\Installer;
  14566. class PackageEvents
  14567. {
  14568. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  14569. const POST_PACKAGE_INSTALL = 'post-package-install';
  14570. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  14571. const POST_PACKAGE_UPDATE = 'post-package-update';
  14572. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  14573. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  14574. }
  14575. <?php
  14576. namespace Composer\Installer;
  14577. use Composer\IO\IOInterface;
  14578. use Composer\Package\PackageInterface;
  14579. use Composer\Util\Filesystem;
  14580. use Composer\Util\ProcessExecutor;
  14581. class PearBinaryInstaller extends BinaryInstaller
  14582. {
  14583. private $installer;
  14584. private $vendorDir;
  14585. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  14586. {
  14587. parent::__construct($io, $binDir, $binCompat, $filesystem);
  14588. $this->installer = $installer;
  14589. $this->vendorDir = $vendorDir;
  14590. }
  14591. protected function getBinaries(PackageInterface $package)
  14592. {
  14593. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  14594. $binaries = array();
  14595. if (file_exists($binariesPath)) {
  14596. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  14597. if (!$value->isDir()) {
  14598. $binaries[] = 'bin/'.$fileName;
  14599. }
  14600. }
  14601. }
  14602. return $binaries;
  14603. }
  14604. protected function initializeBinDir()
  14605. {
  14606. parent::initializeBinDir();
  14607. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  14608. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  14609. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  14610. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  14611. }
  14612. protected function generateWindowsProxyCode($bin, $link)
  14613. {
  14614. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14615. if ('.bat' === substr($bin, -4)) {
  14616. $caller = 'call';
  14617. } else {
  14618. $handle = fopen($bin, 'r');
  14619. $line = fgets($handle);
  14620. fclose($handle);
  14621. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14622. $caller = trim($match[1]);
  14623. } else {
  14624. $caller = 'php';
  14625. }
  14626. if ($caller === 'php') {
  14627. return "@echo off\r\n".
  14628. "pushd .\r\n".
  14629. "cd %~dp0\r\n".
  14630. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  14631. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  14632. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  14633. "popd\r\n".
  14634. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  14635. }
  14636. }
  14637. return "@echo off\r\n".
  14638. "pushd .\r\n".
  14639. "cd %~dp0\r\n".
  14640. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  14641. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  14642. "popd\r\n".
  14643. $caller." \"%BIN_TARGET%\" %*\r\n";
  14644. }
  14645. private function generateWindowsPhpProxyCode()
  14646. {
  14647. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  14648. return
  14649. "@echo off\r\n" .
  14650. "setlocal enabledelayedexpansion\r\n" .
  14651. "set BIN_DIR=%~dp0\r\n" .
  14652. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  14653. "set DIRS=.\r\n" .
  14654. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  14655. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  14656. " set DIRS=!DIRS!;%%~fP\r\n" .
  14657. " )\r\n" .
  14658. ")\r\n" .
  14659. "php.exe -d include_path=!DIRS! %*\r\n";
  14660. }
  14661. private function generateUnixyPhpProxyCode()
  14662. {
  14663. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  14664. return
  14665. "#!/usr/bin/env sh\n".
  14666. "SRC_DIR=`pwd`\n".
  14667. "BIN_DIR=`dirname $0`\n".
  14668. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  14669. "DIRS=\"\"\n".
  14670. "for vendor in \$VENDOR_DIR/*; do\n".
  14671. " if [ -d \"\$vendor\" ]; then\n".
  14672. " for package in \$vendor/*; do\n".
  14673. " if [ -d \"\$package\" ]; then\n".
  14674. " DIRS=\"\${DIRS}:\${package}\"\n".
  14675. " fi\n".
  14676. " done\n".
  14677. " fi\n".
  14678. "done\n".
  14679. "php -d include_path=\".\$DIRS\" $@\n";
  14680. }
  14681. }
  14682. <?php
  14683. namespace Composer\Installer;
  14684. use Composer\IO\IOInterface;
  14685. use Composer\Composer;
  14686. use Composer\Downloader\PearPackageExtractor;
  14687. use Composer\Repository\InstalledRepositoryInterface;
  14688. use Composer\Package\PackageInterface;
  14689. use Composer\Util\Platform;
  14690. use Composer\Util\Filesystem;
  14691. class PearInstaller extends LibraryInstaller
  14692. {
  14693. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  14694. {
  14695. $filesystem = new Filesystem();
  14696. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  14697. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  14698. }
  14699. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14700. {
  14701. $this->uninstall($repo, $initial);
  14702. $this->install($repo, $target);
  14703. }
  14704. protected function installCode(PackageInterface $package)
  14705. {
  14706. parent::installCode($package);
  14707. $isWindows = Platform::isWindows();
  14708. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  14709. if (!$isWindows) {
  14710. $php_bin = '/usr/bin/env ' . $php_bin;
  14711. }
  14712. $installPath = $this->getInstallPath($package);
  14713. $vars = array(
  14714. 'os' => $isWindows ? 'windows' : 'linux',
  14715. 'php_bin' => $php_bin,
  14716. 'pear_php' => $installPath,
  14717. 'php_dir' => $installPath,
  14718. 'bin_dir' => $installPath . '/bin',
  14719. 'data_dir' => $installPath . '/data',
  14720. 'version' => $package->getPrettyVersion(),
  14721. );
  14722. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  14723. $pearExtractor = new PearPackageExtractor($packageArchive);
  14724. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  14725. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  14726. $this->filesystem->unlink($packageArchive);
  14727. }
  14728. }
  14729. <?php
  14730. namespace Composer\Installer;
  14731. use Composer\Composer;
  14732. use Composer\IO\IOInterface;
  14733. use Composer\Repository\InstalledRepositoryInterface;
  14734. use Composer\Package\PackageInterface;
  14735. class PluginInstaller extends LibraryInstaller
  14736. {
  14737. private $installationManager;
  14738. public function __construct(IOInterface $io, Composer $composer)
  14739. {
  14740. parent::__construct($io, $composer, 'composer-plugin');
  14741. $this->installationManager = $composer->getInstallationManager();
  14742. }
  14743. public function supports($packageType)
  14744. {
  14745. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  14746. }
  14747. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14748. {
  14749. $extra = $package->getExtra();
  14750. if (empty($extra['class'])) {
  14751. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  14752. }
  14753. parent::install($repo, $package);
  14754. try {
  14755. $this->composer->getPluginManager()->registerPackage($package, true);
  14756. } catch (\Exception $e) {
  14757. $this->io->writeError('Plugin installation failed, rolling back');
  14758. parent::uninstall($repo, $package);
  14759. throw $e;
  14760. }
  14761. }
  14762. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14763. {
  14764. $extra = $target->getExtra();
  14765. if (empty($extra['class'])) {
  14766. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  14767. }
  14768. parent::update($repo, $initial, $target);
  14769. $this->composer->getPluginManager()->registerPackage($target, true);
  14770. }
  14771. }
  14772. <?php
  14773. namespace Composer\Installer;
  14774. use Composer\Package\PackageInterface;
  14775. use Composer\Downloader\DownloadManager;
  14776. use Composer\Repository\InstalledRepositoryInterface;
  14777. use Composer\Util\Filesystem;
  14778. class ProjectInstaller implements InstallerInterface
  14779. {
  14780. private $installPath;
  14781. private $downloadManager;
  14782. private $filesystem;
  14783. public function __construct($installPath, DownloadManager $dm)
  14784. {
  14785. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  14786. $this->downloadManager = $dm;
  14787. $this->filesystem = new Filesystem;
  14788. }
  14789. public function supports($packageType)
  14790. {
  14791. return true;
  14792. }
  14793. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14794. {
  14795. return false;
  14796. }
  14797. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14798. {
  14799. $installPath = $this->installPath;
  14800. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  14801. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  14802. }
  14803. if (!is_dir($installPath)) {
  14804. mkdir($installPath, 0777, true);
  14805. }
  14806. $this->downloadManager->download($package, $installPath);
  14807. }
  14808. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14809. {
  14810. throw new \InvalidArgumentException("not supported");
  14811. }
  14812. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14813. {
  14814. throw new \InvalidArgumentException("not supported");
  14815. }
  14816. public function getInstallPath(PackageInterface $package)
  14817. {
  14818. return $this->installPath;
  14819. }
  14820. }
  14821. <?php
  14822. namespace Composer\Installer;
  14823. use Composer\IO\IOInterface;
  14824. use Composer\Package\PackageInterface;
  14825. use Composer\Repository\RepositoryInterface;
  14826. use Symfony\Component\Console\Formatter\OutputFormatter;
  14827. class SuggestedPackagesReporter
  14828. {
  14829. protected $suggestedPackages = array();
  14830. private $io;
  14831. public function __construct(IOInterface $io)
  14832. {
  14833. $this->io = $io;
  14834. }
  14835. public function getPackages()
  14836. {
  14837. return $this->suggestedPackages;
  14838. }
  14839. public function addPackage($source, $target, $reason)
  14840. {
  14841. $this->suggestedPackages[] = array(
  14842. 'source' => $source,
  14843. 'target' => $target,
  14844. 'reason' => $reason,
  14845. );
  14846. return $this;
  14847. }
  14848. public function addSuggestionsFromPackage(PackageInterface $package)
  14849. {
  14850. $source = $package->getPrettyName();
  14851. foreach ($package->getSuggests() as $target => $reason) {
  14852. $this->addPackage(
  14853. $source,
  14854. $target,
  14855. $reason
  14856. );
  14857. }
  14858. return $this;
  14859. }
  14860. public function output(RepositoryInterface $installedRepo = null)
  14861. {
  14862. $suggestedPackages = $this->getPackages();
  14863. $installedPackages = array();
  14864. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  14865. foreach ($installedRepo->getPackages() as $package) {
  14866. $installedPackages = array_merge(
  14867. $installedPackages,
  14868. $package->getNames()
  14869. );
  14870. }
  14871. }
  14872. foreach ($suggestedPackages as $suggestion) {
  14873. if (in_array($suggestion['target'], $installedPackages)) {
  14874. continue;
  14875. }
  14876. $this->io->writeError(sprintf(
  14877. '%s suggests installing %s (%s)',
  14878. $suggestion['source'],
  14879. $this->escapeOutput($suggestion['target']),
  14880. $this->escapeOutput($suggestion['reason'])
  14881. ));
  14882. }
  14883. return $this;
  14884. }
  14885. private function escapeOutput($string)
  14886. {
  14887. return OutputFormatter::escape(
  14888. $this->removeControlCharacters($string)
  14889. );
  14890. }
  14891. private function removeControlCharacters($string)
  14892. {
  14893. return preg_replace(
  14894. '/[[:cntrl:]]/',
  14895. '',
  14896. str_replace("\n", ' ', $string)
  14897. );
  14898. }
  14899. }
  14900. <?php
  14901. namespace Composer\Json;
  14902. use JsonSchema\Validator;
  14903. use Seld\JsonLint\JsonParser;
  14904. use Seld\JsonLint\ParsingException;
  14905. use Composer\Util\RemoteFilesystem;
  14906. use Composer\IO\IOInterface;
  14907. use Composer\Downloader\TransportException;
  14908. class JsonFile
  14909. {
  14910. const LAX_SCHEMA = 1;
  14911. const STRICT_SCHEMA = 2;
  14912. const JSON_UNESCAPED_SLASHES = 64;
  14913. const JSON_PRETTY_PRINT = 128;
  14914. const JSON_UNESCAPED_UNICODE = 256;
  14915. private $path;
  14916. private $rfs;
  14917. private $io;
  14918. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  14919. {
  14920. $this->path = $path;
  14921. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  14922. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  14923. }
  14924. $this->rfs = $rfs;
  14925. $this->io = $io;
  14926. }
  14927. public function getPath()
  14928. {
  14929. return $this->path;
  14930. }
  14931. public function exists()
  14932. {
  14933. return is_file($this->path);
  14934. }
  14935. public function read()
  14936. {
  14937. try {
  14938. if ($this->rfs) {
  14939. $json = $this->rfs->getContents($this->path, $this->path, false);
  14940. } else {
  14941. if ($this->io && $this->io->isDebug()) {
  14942. $this->io->writeError('Reading ' . $this->path);
  14943. }
  14944. $json = file_get_contents($this->path);
  14945. }
  14946. } catch (TransportException $e) {
  14947. throw new \RuntimeException($e->getMessage(), 0, $e);
  14948. } catch (\Exception $e) {
  14949. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  14950. }
  14951. return static::parseJson($json, $this->path);
  14952. }
  14953. public function write(array $hash, $options = 448)
  14954. {
  14955. $dir = dirname($this->path);
  14956. if (!is_dir($dir)) {
  14957. if (file_exists($dir)) {
  14958. throw new \UnexpectedValueException(
  14959. $dir.' exists and is not a directory.'
  14960. );
  14961. }
  14962. if (!@mkdir($dir, 0777, true)) {
  14963. throw new \UnexpectedValueException(
  14964. $dir.' does not exist and could not be created.'
  14965. );
  14966. }
  14967. }
  14968. $retries = 3;
  14969. while ($retries--) {
  14970. try {
  14971. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  14972. break;
  14973. } catch (\Exception $e) {
  14974. if ($retries) {
  14975. usleep(500000);
  14976. continue;
  14977. }
  14978. throw $e;
  14979. }
  14980. }
  14981. }
  14982. public function validateSchema($schema = self::STRICT_SCHEMA)
  14983. {
  14984. $content = file_get_contents($this->path);
  14985. $data = json_decode($content);
  14986. if (null === $data && 'null' !== $content) {
  14987. self::validateSyntax($content, $this->path);
  14988. }
  14989. $schemaFile = __DIR__ . '/../../../res/composer-schema.json';
  14990. if (false === strpos($schemaFile, '://')) {
  14991. $schemaFile = 'file://' . $schemaFile;
  14992. }
  14993. $schemaData = (object) array('$ref' => $schemaFile);
  14994. if ($schema === self::LAX_SCHEMA) {
  14995. $schemaData->additionalProperties = true;
  14996. $schemaData->required = array();
  14997. }
  14998. $validator = new Validator();
  14999. $validator->check($data, $schemaData);
  15000. if (!$validator->isValid()) {
  15001. $errors = array();
  15002. foreach ((array) $validator->getErrors() as $error) {
  15003. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  15004. }
  15005. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  15006. }
  15007. return true;
  15008. }
  15009. public static function encode($data, $options = 448)
  15010. {
  15011. if (PHP_VERSION_ID >= 50400) {
  15012. $json = json_encode($data, $options);
  15013. if (false === $json) {
  15014. self::throwEncodeError(json_last_error());
  15015. }
  15016. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  15017. $json = preg_replace('/\[\s+\]/', '[]', $json);
  15018. $json = preg_replace('/\{\s+\}/', '{}', $json);
  15019. }
  15020. return $json;
  15021. }
  15022. $json = json_encode($data);
  15023. if (false === $json) {
  15024. self::throwEncodeError(json_last_error());
  15025. }
  15026. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  15027. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  15028. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  15029. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  15030. return $json;
  15031. }
  15032. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  15033. }
  15034. private static function throwEncodeError($code)
  15035. {
  15036. switch ($code) {
  15037. case JSON_ERROR_DEPTH:
  15038. $msg = 'Maximum stack depth exceeded';
  15039. break;
  15040. case JSON_ERROR_STATE_MISMATCH:
  15041. $msg = 'Underflow or the modes mismatch';
  15042. break;
  15043. case JSON_ERROR_CTRL_CHAR:
  15044. $msg = 'Unexpected control character found';
  15045. break;
  15046. case JSON_ERROR_UTF8:
  15047. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  15048. break;
  15049. default:
  15050. $msg = 'Unknown error';
  15051. }
  15052. throw new \RuntimeException('JSON encoding failed: '.$msg);
  15053. }
  15054. public static function parseJson($json, $file = null)
  15055. {
  15056. if (null === $json) {
  15057. return;
  15058. }
  15059. $data = json_decode($json, true);
  15060. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  15061. self::validateSyntax($json, $file);
  15062. }
  15063. return $data;
  15064. }
  15065. protected static function validateSyntax($json, $file = null)
  15066. {
  15067. $parser = new JsonParser();
  15068. $result = $parser->lint($json);
  15069. if (null === $result) {
  15070. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  15071. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  15072. }
  15073. return true;
  15074. }
  15075. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  15076. }
  15077. }
  15078. <?php
  15079. namespace Composer\Json;
  15080. class JsonFormatter
  15081. {
  15082. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  15083. {
  15084. $result = '';
  15085. $pos = 0;
  15086. $strLen = strlen($json);
  15087. $indentStr = ' ';
  15088. $newLine = "\n";
  15089. $outOfQuotes = true;
  15090. $buffer = '';
  15091. $noescape = true;
  15092. for ($i = 0; $i < $strLen; $i++) {
  15093. $char = substr($json, $i, 1);
  15094. if ('"' === $char && $noescape) {
  15095. $outOfQuotes = !$outOfQuotes;
  15096. }
  15097. if (!$outOfQuotes) {
  15098. $buffer .= $char;
  15099. $noescape = '\\' === $char ? !$noescape : true;
  15100. continue;
  15101. } elseif ('' !== $buffer) {
  15102. if ($unescapeSlashes) {
  15103. $buffer = str_replace('\\/', '/', $buffer);
  15104. }
  15105. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  15106. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  15107. $l = strlen($match[1]);
  15108. if ($l % 2) {
  15109. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  15110. pack('H*', $match[2]),
  15111. 'UTF-8',
  15112. 'UCS-2BE'
  15113. );
  15114. }
  15115. return $match[0];
  15116. }, $buffer);
  15117. }
  15118. $result .= $buffer.$char;
  15119. $buffer = '';
  15120. continue;
  15121. }
  15122. if (':' === $char) {
  15123. $char .= ' ';
  15124. } elseif (('}' === $char || ']' === $char)) {
  15125. $pos--;
  15126. $prevChar = substr($json, $i - 1, 1);
  15127. if ('{' !== $prevChar && '[' !== $prevChar) {
  15128. $result .= $newLine;
  15129. for ($j = 0; $j < $pos; $j++) {
  15130. $result .= $indentStr;
  15131. }
  15132. } else {
  15133. $result = rtrim($result);
  15134. }
  15135. }
  15136. $result .= $char;
  15137. if (',' === $char || '{' === $char || '[' === $char) {
  15138. $result .= $newLine;
  15139. if ('{' === $char || '[' === $char) {
  15140. $pos++;
  15141. }
  15142. for ($j = 0; $j < $pos; $j++) {
  15143. $result .= $indentStr;
  15144. }
  15145. }
  15146. }
  15147. return $result;
  15148. }
  15149. }
  15150. <?php
  15151. namespace Composer\Json;
  15152. use Composer\Repository\PlatformRepository;
  15153. class JsonManipulator
  15154. {
  15155. private static $DEFINES = '(?(DEFINE)
  15156. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  15157. (?<boolean> true | false | null )
  15158. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " )
  15159. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  15160. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  15161. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  15162. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  15163. )';
  15164. private $contents;
  15165. private $newline;
  15166. private $indent;
  15167. public function __construct($contents)
  15168. {
  15169. $contents = trim($contents);
  15170. if ($contents === '') {
  15171. $contents = '{}';
  15172. }
  15173. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  15174. throw new \InvalidArgumentException('The json file must be an object ({})');
  15175. }
  15176. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  15177. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  15178. $this->detectIndenting();
  15179. }
  15180. public function getContents()
  15181. {
  15182. return $this->contents . $this->newline;
  15183. }
  15184. public function addLink($type, $package, $constraint, $sortPackages = false)
  15185. {
  15186. $decoded = JsonFile::parseJson($this->contents);
  15187. if (!isset($decoded[$type])) {
  15188. return $this->addMainKey($type, array($package => $constraint));
  15189. }
  15190. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15191. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  15192. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  15193. return false;
  15194. }
  15195. $links = $matches['value'];
  15196. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  15197. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  15198. if ($this->pregMatch($regex, $links, $packageMatches)) {
  15199. $existingPackage = $packageMatches['package'];
  15200. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  15201. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  15202. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  15203. }, $links);
  15204. } else {
  15205. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  15206. $links = preg_replace(
  15207. '{'.preg_quote($match[1]).'$}',
  15208. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  15209. $links
  15210. );
  15211. } else {
  15212. $links = '{' . $this->newline .
  15213. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  15214. $this->indent . '}';
  15215. }
  15216. }
  15217. if (true === $sortPackages) {
  15218. $requirements = json_decode($links, true);
  15219. $this->sortPackages($requirements);
  15220. $links = $this->format($requirements);
  15221. }
  15222. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  15223. return true;
  15224. }
  15225. private function sortPackages(array &$packages = array())
  15226. {
  15227. $prefix = function ($requirement) {
  15228. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  15229. return preg_replace(
  15230. array(
  15231. '/^php/',
  15232. '/^hhvm/',
  15233. '/^ext/',
  15234. '/^lib/',
  15235. '/^\D/',
  15236. ),
  15237. array(
  15238. '0-$0',
  15239. '1-$0',
  15240. '2-$0',
  15241. '3-$0',
  15242. '4-$0',
  15243. ),
  15244. $requirement
  15245. );
  15246. }
  15247. return '5-'.$requirement;
  15248. };
  15249. uksort($packages, function ($a, $b) use ($prefix) {
  15250. return strnatcmp($prefix($a), $prefix($b));
  15251. });
  15252. }
  15253. public function addRepository($name, $config)
  15254. {
  15255. return $this->addSubNode('repositories', $name, $config);
  15256. }
  15257. public function removeRepository($name)
  15258. {
  15259. return $this->removeSubNode('repositories', $name);
  15260. }
  15261. public function addConfigSetting($name, $value)
  15262. {
  15263. return $this->addSubNode('config', $name, $value);
  15264. }
  15265. public function removeConfigSetting($name)
  15266. {
  15267. return $this->removeSubNode('config', $name);
  15268. }
  15269. public function addProperty($name, $value)
  15270. {
  15271. if (substr($name, 0, 6) === 'extra.') {
  15272. return $this->addSubNode('extra', substr($name, 6), $value);
  15273. }
  15274. return $this->addMainKey($name, $value);
  15275. }
  15276. public function removeProperty($name)
  15277. {
  15278. if (substr($name, 0, 6) === 'extra.') {
  15279. return $this->removeSubNode('extra', substr($name, 6));
  15280. }
  15281. return $this->removeMainKey($name);
  15282. }
  15283. public function addSubNode($mainNode, $name, $value)
  15284. {
  15285. $decoded = JsonFile::parseJson($this->contents);
  15286. $subName = null;
  15287. if (in_array($mainNode, array('config', 'extra')) && false !== strpos($name, '.')) {
  15288. list($name, $subName) = explode('.', $name, 2);
  15289. }
  15290. if (!isset($decoded[$mainNode])) {
  15291. if ($subName !== null) {
  15292. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  15293. } else {
  15294. $this->addMainKey($mainNode, array($name => $value));
  15295. }
  15296. return true;
  15297. }
  15298. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15299. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15300. try {
  15301. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15302. return false;
  15303. }
  15304. } catch (\RuntimeException $e) {
  15305. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15306. return false;
  15307. }
  15308. throw $e;
  15309. }
  15310. $children = $match['content'];
  15311. if (!@json_decode($children)) {
  15312. return false;
  15313. }
  15314. $that = $this;
  15315. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  15316. if ($this->pregMatch($childRegex, $children, $matches)) {
  15317. $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
  15318. if ($subName !== null) {
  15319. $curVal = json_decode($matches['content'], true);
  15320. if (!is_array($curVal)) {
  15321. $curVal = array();
  15322. }
  15323. $curVal[$subName] = $value;
  15324. $value = $curVal;
  15325. }
  15326. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  15327. }, $children);
  15328. } else {
  15329. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  15330. $whitespace = '';
  15331. if (!empty($match['trailingspace'])) {
  15332. $whitespace = $match['trailingspace'];
  15333. }
  15334. if (!empty($match['content'])) {
  15335. if ($subName !== null) {
  15336. $value = array($subName => $value);
  15337. }
  15338. $children = preg_replace(
  15339. '#'.$whitespace.'}$#',
  15340. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  15341. $children
  15342. );
  15343. } else {
  15344. if ($subName !== null) {
  15345. $value = array($subName => $value);
  15346. }
  15347. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  15348. }
  15349. }
  15350. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  15351. return $m['start'] . $children . $m['end'];
  15352. }, $this->contents);
  15353. return true;
  15354. }
  15355. public function removeSubNode($mainNode, $name)
  15356. {
  15357. $decoded = JsonFile::parseJson($this->contents);
  15358. if (empty($decoded[$mainNode])) {
  15359. return true;
  15360. }
  15361. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15362. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15363. try {
  15364. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15365. return false;
  15366. }
  15367. } catch (\RuntimeException $e) {
  15368. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15369. return false;
  15370. }
  15371. throw $e;
  15372. }
  15373. $children = $match['content'];
  15374. if (!@json_decode($children, true)) {
  15375. return false;
  15376. }
  15377. $subName = null;
  15378. if (in_array($mainNode, array('config', 'extra')) && false !== strpos($name, '.')) {
  15379. list($name, $subName) = explode('.', $name, 2);
  15380. }
  15381. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  15382. return true;
  15383. }
  15384. if ($this->pregMatch('{"'.preg_quote($name).'"\s*:}i', $children)) {
  15385. if (preg_match_all('{'.self::$DEFINES.'"'.preg_quote($name).'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  15386. $bestMatch = '';
  15387. foreach ($matches[0] as $match) {
  15388. if (strlen($bestMatch) < strlen($match)) {
  15389. $bestMatch = $match;
  15390. }
  15391. }
  15392. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  15393. if (1 !== $count) {
  15394. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  15395. if (1 !== $count) {
  15396. return false;
  15397. }
  15398. }
  15399. }
  15400. } else {
  15401. $childrenClean = $children;
  15402. }
  15403. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  15404. if (empty($match['content'])) {
  15405. $newline = $this->newline;
  15406. $indent = $this->indent;
  15407. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  15408. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  15409. }, $this->contents);
  15410. if ($subName !== null) {
  15411. $curVal = json_decode($children, true);
  15412. unset($curVal[$name][$subName]);
  15413. $this->addSubNode($mainNode, $name, $curVal[$name]);
  15414. }
  15415. return true;
  15416. }
  15417. $that = $this;
  15418. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  15419. if ($subName !== null) {
  15420. $curVal = json_decode($matches['content'], true);
  15421. unset($curVal[$name][$subName]);
  15422. $childrenClean = $that->format($curVal, 0);
  15423. }
  15424. return $matches['start'] . $childrenClean . $matches['end'];
  15425. }, $this->contents);
  15426. return true;
  15427. }
  15428. public function addMainKey($key, $content)
  15429. {
  15430. $decoded = JsonFile::parseJson($this->contents);
  15431. $content = $this->format($content);
  15432. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15433. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  15434. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  15435. if (!@json_decode('{'.$matches['key'].'}')) {
  15436. return false;
  15437. }
  15438. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  15439. return true;
  15440. }
  15441. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  15442. $this->contents = preg_replace(
  15443. '#'.$match[1].'\}$#',
  15444. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  15445. $this->contents
  15446. );
  15447. return true;
  15448. }
  15449. $this->contents = preg_replace(
  15450. '#\}$#',
  15451. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  15452. $this->contents
  15453. );
  15454. return true;
  15455. }
  15456. public function removeMainKey($key)
  15457. {
  15458. $decoded = JsonFile::parseJson($this->contents);
  15459. if (!array_key_exists($key, $decoded)) {
  15460. return true;
  15461. }
  15462. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15463. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  15464. if ($this->pregMatch($regex, $this->contents, $matches)) {
  15465. if (!@json_decode('{'.$matches['removal'].'}')) {
  15466. return false;
  15467. }
  15468. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  15469. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  15470. }
  15471. $this->contents = $matches['start'] . $matches['end'];
  15472. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  15473. $this->contents = "{\n}";
  15474. }
  15475. return true;
  15476. }
  15477. return false;
  15478. }
  15479. public function format($data, $depth = 0)
  15480. {
  15481. if (is_array($data)) {
  15482. reset($data);
  15483. if (is_numeric(key($data))) {
  15484. foreach ($data as $key => $val) {
  15485. $data[$key] = $this->format($val, $depth + 1);
  15486. }
  15487. return '['.implode(', ', $data).']';
  15488. }
  15489. $out = '{' . $this->newline;
  15490. $elems = array();
  15491. foreach ($data as $key => $val) {
  15492. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  15493. }
  15494. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  15495. }
  15496. return JsonFile::encode($data);
  15497. }
  15498. protected function detectIndenting()
  15499. {
  15500. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  15501. $this->indent = $match[1];
  15502. } else {
  15503. $this->indent = ' ';
  15504. }
  15505. }
  15506. protected function pregMatch($re, $str, &$matches = array())
  15507. {
  15508. $count = preg_match($re, $str, $matches);
  15509. if ($count === false) {
  15510. switch (preg_last_error()) {
  15511. case PREG_NO_ERROR:
  15512. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  15513. case PREG_INTERNAL_ERROR:
  15514. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  15515. case PREG_BACKTRACK_LIMIT_ERROR:
  15516. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  15517. case PREG_RECURSION_LIMIT_ERROR:
  15518. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  15519. case PREG_BAD_UTF8_ERROR:
  15520. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  15521. case PREG_BAD_UTF8_OFFSET_ERROR:
  15522. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  15523. case 6:
  15524. if (PHP_VERSION_ID > 70000) {
  15525. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  15526. }
  15527. default:
  15528. throw new \RuntimeException('Failed to execute regex: Unknown error');
  15529. }
  15530. }
  15531. return $count;
  15532. }
  15533. }
  15534. <?php
  15535. namespace Composer\Json;
  15536. use Exception;
  15537. class JsonValidationException extends Exception
  15538. {
  15539. protected $errors;
  15540. public function __construct($message, $errors = array(), Exception $previous = null)
  15541. {
  15542. $this->errors = $errors;
  15543. parent::__construct($message, 0, $previous);
  15544. }
  15545. public function getErrors()
  15546. {
  15547. return $this->errors;
  15548. }
  15549. }
  15550. <?php
  15551. namespace Composer\Package;
  15552. use Composer\Semver\Constraint\Constraint;
  15553. use Composer\Package\Version\VersionParser;
  15554. class AliasPackage extends BasePackage implements CompletePackageInterface
  15555. {
  15556. protected $version;
  15557. protected $prettyVersion;
  15558. protected $dev;
  15559. protected $rootPackageAlias = false;
  15560. protected $stability;
  15561. protected $aliasOf;
  15562. protected $requires;
  15563. protected $devRequires;
  15564. protected $conflicts;
  15565. protected $provides;
  15566. protected $replaces;
  15567. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  15568. {
  15569. parent::__construct($aliasOf->getName());
  15570. $this->version = $version;
  15571. $this->prettyVersion = $prettyVersion;
  15572. $this->aliasOf = $aliasOf;
  15573. $this->stability = VersionParser::parseStability($version);
  15574. $this->dev = $this->stability === 'dev';
  15575. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  15576. $links = $aliasOf->{'get' . ucfirst($type)}();
  15577. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  15578. }
  15579. }
  15580. public function getAliasOf()
  15581. {
  15582. return $this->aliasOf;
  15583. }
  15584. public function getVersion()
  15585. {
  15586. return $this->version;
  15587. }
  15588. public function getStability()
  15589. {
  15590. return $this->stability;
  15591. }
  15592. public function getPrettyVersion()
  15593. {
  15594. return $this->prettyVersion;
  15595. }
  15596. public function isDev()
  15597. {
  15598. return $this->dev;
  15599. }
  15600. public function getRequires()
  15601. {
  15602. return $this->requires;
  15603. }
  15604. public function getConflicts()
  15605. {
  15606. return $this->conflicts;
  15607. }
  15608. public function getProvides()
  15609. {
  15610. return $this->provides;
  15611. }
  15612. public function getReplaces()
  15613. {
  15614. return $this->replaces;
  15615. }
  15616. public function getDevRequires()
  15617. {
  15618. return $this->devRequires;
  15619. }
  15620. public function setRootPackageAlias($value)
  15621. {
  15622. return $this->rootPackageAlias = $value;
  15623. }
  15624. public function isRootPackageAlias()
  15625. {
  15626. return $this->rootPackageAlias;
  15627. }
  15628. protected function replaceSelfVersionDependencies(array $links, $linkType)
  15629. {
  15630. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  15631. $newLinks = array();
  15632. foreach ($links as $link) {
  15633. if ('self.version' === $link->getPrettyConstraint()) {
  15634. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  15635. }
  15636. }
  15637. $links = array_merge($links, $newLinks);
  15638. } else {
  15639. foreach ($links as $index => $link) {
  15640. if ('self.version' === $link->getPrettyConstraint()) {
  15641. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  15642. }
  15643. }
  15644. }
  15645. return $links;
  15646. }
  15647. public function getType()
  15648. {
  15649. return $this->aliasOf->getType();
  15650. }
  15651. public function getTargetDir()
  15652. {
  15653. return $this->aliasOf->getTargetDir();
  15654. }
  15655. public function getExtra()
  15656. {
  15657. return $this->aliasOf->getExtra();
  15658. }
  15659. public function setInstallationSource($type)
  15660. {
  15661. $this->aliasOf->setInstallationSource($type);
  15662. }
  15663. public function getInstallationSource()
  15664. {
  15665. return $this->aliasOf->getInstallationSource();
  15666. }
  15667. public function getSourceType()
  15668. {
  15669. return $this->aliasOf->getSourceType();
  15670. }
  15671. public function getSourceUrl()
  15672. {
  15673. return $this->aliasOf->getSourceUrl();
  15674. }
  15675. public function getSourceUrls()
  15676. {
  15677. return $this->aliasOf->getSourceUrls();
  15678. }
  15679. public function getSourceReference()
  15680. {
  15681. return $this->aliasOf->getSourceReference();
  15682. }
  15683. public function setSourceReference($reference)
  15684. {
  15685. return $this->aliasOf->setSourceReference($reference);
  15686. }
  15687. public function setSourceMirrors($mirrors)
  15688. {
  15689. return $this->aliasOf->setSourceMirrors($mirrors);
  15690. }
  15691. public function getSourceMirrors()
  15692. {
  15693. return $this->aliasOf->getSourceMirrors();
  15694. }
  15695. public function getDistType()
  15696. {
  15697. return $this->aliasOf->getDistType();
  15698. }
  15699. public function getDistUrl()
  15700. {
  15701. return $this->aliasOf->getDistUrl();
  15702. }
  15703. public function getDistUrls()
  15704. {
  15705. return $this->aliasOf->getDistUrls();
  15706. }
  15707. public function getDistReference()
  15708. {
  15709. return $this->aliasOf->getDistReference();
  15710. }
  15711. public function setDistReference($reference)
  15712. {
  15713. return $this->aliasOf->setDistReference($reference);
  15714. }
  15715. public function getDistSha1Checksum()
  15716. {
  15717. return $this->aliasOf->getDistSha1Checksum();
  15718. }
  15719. public function setTransportOptions(array $options)
  15720. {
  15721. return $this->aliasOf->setTransportOptions($options);
  15722. }
  15723. public function getTransportOptions()
  15724. {
  15725. return $this->aliasOf->getTransportOptions();
  15726. }
  15727. public function setDistMirrors($mirrors)
  15728. {
  15729. return $this->aliasOf->setDistMirrors($mirrors);
  15730. }
  15731. public function getDistMirrors()
  15732. {
  15733. return $this->aliasOf->getDistMirrors();
  15734. }
  15735. public function getScripts()
  15736. {
  15737. return $this->aliasOf->getScripts();
  15738. }
  15739. public function getLicense()
  15740. {
  15741. return $this->aliasOf->getLicense();
  15742. }
  15743. public function getAutoload()
  15744. {
  15745. return $this->aliasOf->getAutoload();
  15746. }
  15747. public function getDevAutoload()
  15748. {
  15749. return $this->aliasOf->getDevAutoload();
  15750. }
  15751. public function getIncludePaths()
  15752. {
  15753. return $this->aliasOf->getIncludePaths();
  15754. }
  15755. public function getRepositories()
  15756. {
  15757. return $this->aliasOf->getRepositories();
  15758. }
  15759. public function getReleaseDate()
  15760. {
  15761. return $this->aliasOf->getReleaseDate();
  15762. }
  15763. public function getBinaries()
  15764. {
  15765. return $this->aliasOf->getBinaries();
  15766. }
  15767. public function getKeywords()
  15768. {
  15769. return $this->aliasOf->getKeywords();
  15770. }
  15771. public function getDescription()
  15772. {
  15773. return $this->aliasOf->getDescription();
  15774. }
  15775. public function getHomepage()
  15776. {
  15777. return $this->aliasOf->getHomepage();
  15778. }
  15779. public function getSuggests()
  15780. {
  15781. return $this->aliasOf->getSuggests();
  15782. }
  15783. public function getAuthors()
  15784. {
  15785. return $this->aliasOf->getAuthors();
  15786. }
  15787. public function getSupport()
  15788. {
  15789. return $this->aliasOf->getSupport();
  15790. }
  15791. public function getNotificationUrl()
  15792. {
  15793. return $this->aliasOf->getNotificationUrl();
  15794. }
  15795. public function getArchiveExcludes()
  15796. {
  15797. return $this->aliasOf->getArchiveExcludes();
  15798. }
  15799. public function isAbandoned()
  15800. {
  15801. return $this->aliasOf->isAbandoned();
  15802. }
  15803. public function getReplacementPackage()
  15804. {
  15805. return $this->aliasOf->getReplacementPackage();
  15806. }
  15807. public function __toString()
  15808. {
  15809. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  15810. }
  15811. }
  15812. <?php
  15813. namespace Composer\Package\Archiver;
  15814. use FilterIterator;
  15815. use PharData;
  15816. class ArchivableFilesFilter extends FilterIterator
  15817. {
  15818. private $dirs = array();
  15819. public function accept()
  15820. {
  15821. $file = $this->getInnerIterator()->current();
  15822. if ($file->isDir()) {
  15823. $this->dirs[] = (string) $file;
  15824. return false;
  15825. }
  15826. return true;
  15827. }
  15828. public function addEmptyDir(PharData $phar, $sources)
  15829. {
  15830. foreach ($this->dirs as $filepath) {
  15831. $localname = str_replace($sources . "/", '', $filepath);
  15832. $phar->addEmptyDir($localname);
  15833. }
  15834. }
  15835. }
  15836. <?php
  15837. namespace Composer\Package\Archiver;
  15838. use Composer\Util\Filesystem;
  15839. use FilesystemIterator;
  15840. use Symfony\Component\Finder\Finder;
  15841. use Symfony\Component\Finder\SplFileInfo;
  15842. class ArchivableFilesFinder extends \FilterIterator
  15843. {
  15844. protected $finder;
  15845. public function __construct($sources, array $excludes, $ignoreFilters = false)
  15846. {
  15847. $fs = new Filesystem();
  15848. $sources = $fs->normalizePath($sources);
  15849. if ($ignoreFilters) {
  15850. $filters = array();
  15851. } else {
  15852. $filters = array(
  15853. new HgExcludeFilter($sources),
  15854. new GitExcludeFilter($sources),
  15855. new ComposerExcludeFilter($sources, $excludes),
  15856. );
  15857. }
  15858. $this->finder = new Finder();
  15859. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  15860. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  15861. return false;
  15862. }
  15863. $relativePath = preg_replace(
  15864. '#^'.preg_quote($sources, '#').'#',
  15865. '',
  15866. $fs->normalizePath($file->getRealPath())
  15867. );
  15868. $exclude = false;
  15869. foreach ($filters as $filter) {
  15870. $exclude = $filter->filter($relativePath, $exclude);
  15871. }
  15872. return !$exclude;
  15873. };
  15874. if (method_exists($filter, 'bindTo')) {
  15875. $filter = $filter->bindTo(null);
  15876. }
  15877. $this->finder
  15878. ->in($sources)
  15879. ->filter($filter)
  15880. ->ignoreVCS(true)
  15881. ->ignoreDotFiles(false);
  15882. parent::__construct($this->finder->getIterator());
  15883. }
  15884. public function accept()
  15885. {
  15886. $current = $this->getInnerIterator()->current();
  15887. if (!$current->isDir()) {
  15888. return true;
  15889. }
  15890. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  15891. return !$iterator->valid();
  15892. }
  15893. }
  15894. <?php
  15895. namespace Composer\Package\Archiver;
  15896. use Composer\Downloader\DownloadManager;
  15897. use Composer\Package\PackageInterface;
  15898. use Composer\Package\RootPackageInterface;
  15899. use Composer\Util\Filesystem;
  15900. use Composer\Json\JsonFile;
  15901. class ArchiveManager
  15902. {
  15903. protected $downloadManager;
  15904. protected $archivers = array();
  15905. protected $overwriteFiles = true;
  15906. public function __construct(DownloadManager $downloadManager)
  15907. {
  15908. $this->downloadManager = $downloadManager;
  15909. }
  15910. public function addArchiver(ArchiverInterface $archiver)
  15911. {
  15912. $this->archivers[] = $archiver;
  15913. }
  15914. public function setOverwriteFiles($overwriteFiles)
  15915. {
  15916. $this->overwriteFiles = $overwriteFiles;
  15917. return $this;
  15918. }
  15919. public function getPackageFilename(PackageInterface $package)
  15920. {
  15921. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  15922. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  15923. $nameParts = array_merge($nameParts, array($package->getDistReference(), $package->getDistType()));
  15924. } else {
  15925. $nameParts = array_merge($nameParts, array($package->getPrettyVersion(), $package->getDistReference()));
  15926. }
  15927. if ($package->getSourceReference()) {
  15928. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  15929. }
  15930. $name = implode('-', array_filter($nameParts, function ($p) {
  15931. return !empty($p);
  15932. }));
  15933. return str_replace('/', '-', $name);
  15934. }
  15935. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  15936. {
  15937. if (empty($format)) {
  15938. throw new \InvalidArgumentException('Format must be specified');
  15939. }
  15940. $usableArchiver = null;
  15941. foreach ($this->archivers as $archiver) {
  15942. if ($archiver->supports($format, $package->getSourceType())) {
  15943. $usableArchiver = $archiver;
  15944. break;
  15945. }
  15946. }
  15947. if (null === $usableArchiver) {
  15948. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  15949. }
  15950. $filesystem = new Filesystem();
  15951. if (null === $fileName) {
  15952. $packageName = $this->getPackageFilename($package);
  15953. } else {
  15954. $packageName = $fileName;
  15955. }
  15956. $filesystem->ensureDirectoryExists($targetDir);
  15957. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  15958. $filesystem->ensureDirectoryExists(dirname($target));
  15959. if (!$this->overwriteFiles && file_exists($target)) {
  15960. return $target;
  15961. }
  15962. if ($package instanceof RootPackageInterface) {
  15963. $sourcePath = realpath('.');
  15964. } else {
  15965. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  15966. $filesystem->ensureDirectoryExists($sourcePath);
  15967. $this->downloadManager->download($package, $sourcePath);
  15968. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  15969. $jsonFile = new JsonFile($composerJsonPath);
  15970. $jsonData = $jsonFile->read();
  15971. if (!empty($jsonData['archive']['exclude'])) {
  15972. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  15973. }
  15974. }
  15975. }
  15976. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  15977. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  15978. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  15979. $filesystem->rename($archivePath, $target);
  15980. if (!$package instanceof RootPackageInterface) {
  15981. $filesystem->removeDirectory($sourcePath);
  15982. }
  15983. $filesystem->remove($tempTarget);
  15984. return $target;
  15985. }
  15986. }
  15987. <?php
  15988. namespace Composer\Package\Archiver;
  15989. interface ArchiverInterface
  15990. {
  15991. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  15992. public function supports($format, $sourceType);
  15993. }
  15994. <?php
  15995. namespace Composer\Package\Archiver;
  15996. use Symfony\Component\Finder;
  15997. abstract class BaseExcludeFilter
  15998. {
  15999. protected $sourcePath;
  16000. protected $excludePatterns;
  16001. public function __construct($sourcePath)
  16002. {
  16003. $this->sourcePath = $sourcePath;
  16004. $this->excludePatterns = array();
  16005. }
  16006. public function filter($relativePath, $exclude)
  16007. {
  16008. foreach ($this->excludePatterns as $patternData) {
  16009. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  16010. if ($stripLeadingSlash) {
  16011. $path = substr($relativePath, 1);
  16012. } else {
  16013. $path = $relativePath;
  16014. }
  16015. if (preg_match($pattern, $path)) {
  16016. $exclude = !$negate;
  16017. }
  16018. }
  16019. return $exclude;
  16020. }
  16021. protected function parseLines(array $lines, $lineParser)
  16022. {
  16023. return array_filter(
  16024. array_map(
  16025. function ($line) use ($lineParser) {
  16026. $line = trim($line);
  16027. if (!$line || 0 === strpos($line, '#')) {
  16028. return null;
  16029. }
  16030. return call_user_func($lineParser, $line);
  16031. },
  16032. $lines
  16033. ),
  16034. function ($pattern) {
  16035. return $pattern !== null;
  16036. }
  16037. );
  16038. }
  16039. protected function generatePatterns($rules)
  16040. {
  16041. $patterns = array();
  16042. foreach ($rules as $rule) {
  16043. $patterns[] = $this->generatePattern($rule);
  16044. }
  16045. return $patterns;
  16046. }
  16047. protected function generatePattern($rule)
  16048. {
  16049. $negate = false;
  16050. $pattern = '{';
  16051. if (strlen($rule) && $rule[0] === '!') {
  16052. $negate = true;
  16053. $rule = substr($rule, 1);
  16054. }
  16055. if (strlen($rule) && $rule[0] === '/') {
  16056. $pattern .= '^/';
  16057. $rule = substr($rule, 1);
  16058. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  16059. $pattern .= '/';
  16060. $rule = substr($rule, 0, -1);
  16061. } elseif (false === strpos($rule, '/')) {
  16062. $pattern .= '/';
  16063. }
  16064. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  16065. return array($pattern . '}', $negate, false);
  16066. }
  16067. }
  16068. <?php
  16069. namespace Composer\Package\Archiver;
  16070. class ComposerExcludeFilter extends BaseExcludeFilter
  16071. {
  16072. public function __construct($sourcePath, array $excludeRules)
  16073. {
  16074. parent::__construct($sourcePath);
  16075. $this->excludePatterns = $this->generatePatterns($excludeRules);
  16076. }
  16077. }
  16078. <?php
  16079. namespace Composer\Package\Archiver;
  16080. class GitExcludeFilter extends BaseExcludeFilter
  16081. {
  16082. public function __construct($sourcePath)
  16083. {
  16084. parent::__construct($sourcePath);
  16085. if (file_exists($sourcePath.'/.gitignore')) {
  16086. $this->excludePatterns = $this->parseLines(
  16087. file($sourcePath.'/.gitignore'),
  16088. array($this, 'parseGitIgnoreLine')
  16089. );
  16090. }
  16091. if (file_exists($sourcePath.'/.gitattributes')) {
  16092. $this->excludePatterns = array_merge(
  16093. $this->excludePatterns,
  16094. $this->parseLines(
  16095. file($sourcePath.'/.gitattributes'),
  16096. array($this, 'parseGitAttributesLine')
  16097. ));
  16098. }
  16099. }
  16100. public function parseGitIgnoreLine($line)
  16101. {
  16102. return $this->generatePattern($line);
  16103. }
  16104. public function parseGitAttributesLine($line)
  16105. {
  16106. $parts = preg_split('#\s+#', $line);
  16107. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  16108. return $this->generatePattern($parts[0]);
  16109. }
  16110. return null;
  16111. }
  16112. }
  16113. <?php
  16114. namespace Composer\Package\Archiver;
  16115. use Symfony\Component\Finder;
  16116. class HgExcludeFilter extends BaseExcludeFilter
  16117. {
  16118. const HG_IGNORE_REGEX = 1;
  16119. const HG_IGNORE_GLOB = 2;
  16120. protected $patternMode;
  16121. public function __construct($sourcePath)
  16122. {
  16123. parent::__construct($sourcePath);
  16124. $this->patternMode = self::HG_IGNORE_REGEX;
  16125. if (file_exists($sourcePath.'/.hgignore')) {
  16126. $this->excludePatterns = $this->parseLines(
  16127. file($sourcePath.'/.hgignore'),
  16128. array($this, 'parseHgIgnoreLine')
  16129. );
  16130. }
  16131. }
  16132. public function parseHgIgnoreLine($line)
  16133. {
  16134. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  16135. if ($matches[1] === 'glob') {
  16136. $this->patternMode = self::HG_IGNORE_GLOB;
  16137. } else {
  16138. $this->patternMode = self::HG_IGNORE_REGEX;
  16139. }
  16140. return null;
  16141. }
  16142. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  16143. return $this->patternFromGlob($line);
  16144. }
  16145. return $this->patternFromRegex($line);
  16146. }
  16147. protected function patternFromGlob($line)
  16148. {
  16149. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  16150. $pattern = str_replace('[^/]*', '.*', $pattern);
  16151. return array($pattern, false, true);
  16152. }
  16153. public function patternFromRegex($line)
  16154. {
  16155. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  16156. return array($pattern, false, true);
  16157. }
  16158. }
  16159. <?php
  16160. namespace Composer\Package\Archiver;
  16161. class PharArchiver implements ArchiverInterface
  16162. {
  16163. protected static $formats = array(
  16164. 'zip' => \Phar::ZIP,
  16165. 'tar' => \Phar::TAR,
  16166. 'tar.gz' => \Phar::TAR,
  16167. 'tar.bz2' => \Phar::TAR,
  16168. );
  16169. protected static $compressFormats = array(
  16170. 'tar.gz' => \Phar::GZ,
  16171. 'tar.bz2' => \Phar::BZ2,
  16172. );
  16173. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16174. {
  16175. $sources = realpath($sources);
  16176. if (file_exists($target)) {
  16177. unlink($target);
  16178. }
  16179. try {
  16180. $filename = substr($target, 0, strrpos($target, $format) - 1);
  16181. if (isset(static::$compressFormats[$format])) {
  16182. $target = $filename . '.tar';
  16183. }
  16184. $phar = new \PharData($target, null, null, static::$formats[$format]);
  16185. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16186. $filesOnly = new ArchivableFilesFilter($files);
  16187. $phar->buildFromIterator($filesOnly, $sources);
  16188. $filesOnly->addEmptyDir($phar, $sources);
  16189. if (isset(static::$compressFormats[$format])) {
  16190. if (!$phar->canCompress(static::$compressFormats[$format])) {
  16191. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  16192. }
  16193. unlink($target);
  16194. $phar->compress(static::$compressFormats[$format]);
  16195. $target = $filename . '.' . $format;
  16196. }
  16197. return $target;
  16198. } catch (\UnexpectedValueException $e) {
  16199. $message = sprintf("Could not create archive '%s' from '%s': %s",
  16200. $target,
  16201. $sources,
  16202. $e->getMessage()
  16203. );
  16204. throw new \RuntimeException($message, $e->getCode(), $e);
  16205. }
  16206. }
  16207. public function supports($format, $sourceType)
  16208. {
  16209. return isset(static::$formats[$format]);
  16210. }
  16211. }
  16212. <?php
  16213. namespace Composer\Package\Archiver;
  16214. use ZipArchive;
  16215. use Composer\Util\Filesystem;
  16216. class ZipArchiver implements ArchiverInterface
  16217. {
  16218. protected static $formats = array(
  16219. 'zip' => 1,
  16220. );
  16221. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16222. {
  16223. $fs = new Filesystem();
  16224. $sources = $fs->normalizePath($sources);
  16225. $zip = new ZipArchive();
  16226. $res = $zip->open($target, ZipArchive::CREATE);
  16227. if ($res === true) {
  16228. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16229. foreach ($files as $file) {
  16230. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  16231. $localname = str_replace($sources.'/', '', $filepath);
  16232. if ($file->isDir()) {
  16233. $zip->addEmptyDir($localname);
  16234. } else {
  16235. $zip->addFile($filepath, $localname);
  16236. }
  16237. }
  16238. if ($zip->close()) {
  16239. return $target;
  16240. }
  16241. }
  16242. $message = sprintf("Could not create archive '%s' from '%s': %s",
  16243. $target,
  16244. $sources,
  16245. $zip->getStatusString()
  16246. );
  16247. throw new \RuntimeException($message);
  16248. }
  16249. public function supports($format, $sourceType)
  16250. {
  16251. return isset(static::$formats[$format]) && $this->compressionAvailable();
  16252. }
  16253. private function compressionAvailable()
  16254. {
  16255. return class_exists('ZipArchive');
  16256. }
  16257. }
  16258. <?php
  16259. namespace Composer\Package;
  16260. use Composer\Repository\RepositoryInterface;
  16261. use Composer\Repository\PlatformRepository;
  16262. abstract class BasePackage implements PackageInterface
  16263. {
  16264. public static $supportedLinkTypes = array(
  16265. 'require' => array('description' => 'requires', 'method' => 'requires'),
  16266. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  16267. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  16268. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  16269. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  16270. );
  16271. const STABILITY_STABLE = 0;
  16272. const STABILITY_RC = 5;
  16273. const STABILITY_BETA = 10;
  16274. const STABILITY_ALPHA = 15;
  16275. const STABILITY_DEV = 20;
  16276. public static $stabilities = array(
  16277. 'stable' => self::STABILITY_STABLE,
  16278. 'RC' => self::STABILITY_RC,
  16279. 'beta' => self::STABILITY_BETA,
  16280. 'alpha' => self::STABILITY_ALPHA,
  16281. 'dev' => self::STABILITY_DEV,
  16282. );
  16283. public $id;
  16284. protected $name;
  16285. protected $prettyName;
  16286. protected $repository;
  16287. protected $transportOptions = array();
  16288. public function __construct($name)
  16289. {
  16290. $this->prettyName = $name;
  16291. $this->name = strtolower($name);
  16292. $this->id = -1;
  16293. }
  16294. public function getName()
  16295. {
  16296. return $this->name;
  16297. }
  16298. public function getPrettyName()
  16299. {
  16300. return $this->prettyName;
  16301. }
  16302. public function getNames()
  16303. {
  16304. $names = array(
  16305. $this->getName() => true,
  16306. );
  16307. foreach ($this->getProvides() as $link) {
  16308. $names[$link->getTarget()] = true;
  16309. }
  16310. foreach ($this->getReplaces() as $link) {
  16311. $names[$link->getTarget()] = true;
  16312. }
  16313. return array_keys($names);
  16314. }
  16315. public function setId($id)
  16316. {
  16317. $this->id = $id;
  16318. }
  16319. public function getId()
  16320. {
  16321. return $this->id;
  16322. }
  16323. public function setRepository(RepositoryInterface $repository)
  16324. {
  16325. if ($this->repository && $repository !== $this->repository) {
  16326. throw new \LogicException('A package can only be added to one repository');
  16327. }
  16328. $this->repository = $repository;
  16329. }
  16330. public function getRepository()
  16331. {
  16332. return $this->repository;
  16333. }
  16334. public function getTransportOptions()
  16335. {
  16336. return $this->transportOptions;
  16337. }
  16338. public function setTransportOptions(array $options)
  16339. {
  16340. $this->transportOptions = $options;
  16341. }
  16342. public function isPlatform()
  16343. {
  16344. return $this->getRepository() instanceof PlatformRepository;
  16345. }
  16346. public function getUniqueName()
  16347. {
  16348. return $this->getName().'-'.$this->getVersion();
  16349. }
  16350. public function equals(PackageInterface $package)
  16351. {
  16352. $self = $this;
  16353. if ($this instanceof AliasPackage) {
  16354. $self = $this->getAliasOf();
  16355. }
  16356. if ($package instanceof AliasPackage) {
  16357. $package = $package->getAliasOf();
  16358. }
  16359. return $package === $self;
  16360. }
  16361. public function __toString()
  16362. {
  16363. return $this->getUniqueName();
  16364. }
  16365. public function getPrettyString()
  16366. {
  16367. return $this->getPrettyName().' '.$this->getPrettyVersion();
  16368. }
  16369. public function getFullPrettyVersion($truncate = true)
  16370. {
  16371. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  16372. return $this->getPrettyVersion();
  16373. }
  16374. if ($truncate && strlen($this->getSourceReference()) === 40) {
  16375. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  16376. }
  16377. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  16378. }
  16379. public function getStabilityPriority()
  16380. {
  16381. return self::$stabilities[$this->getStability()];
  16382. }
  16383. public function __clone()
  16384. {
  16385. $this->repository = null;
  16386. $this->id = -1;
  16387. }
  16388. }
  16389. <?php
  16390. namespace Composer\Package;
  16391. class CompletePackage extends Package implements CompletePackageInterface
  16392. {
  16393. protected $repositories;
  16394. protected $license = array();
  16395. protected $keywords;
  16396. protected $authors;
  16397. protected $description;
  16398. protected $homepage;
  16399. protected $scripts = array();
  16400. protected $support = array();
  16401. protected $abandoned = false;
  16402. public function setScripts(array $scripts)
  16403. {
  16404. $this->scripts = $scripts;
  16405. }
  16406. public function getScripts()
  16407. {
  16408. return $this->scripts;
  16409. }
  16410. public function setRepositories($repositories)
  16411. {
  16412. $this->repositories = $repositories;
  16413. }
  16414. public function getRepositories()
  16415. {
  16416. return $this->repositories;
  16417. }
  16418. public function setLicense(array $license)
  16419. {
  16420. $this->license = $license;
  16421. }
  16422. public function getLicense()
  16423. {
  16424. return $this->license;
  16425. }
  16426. public function setKeywords(array $keywords)
  16427. {
  16428. $this->keywords = $keywords;
  16429. }
  16430. public function getKeywords()
  16431. {
  16432. return $this->keywords;
  16433. }
  16434. public function setAuthors(array $authors)
  16435. {
  16436. $this->authors = $authors;
  16437. }
  16438. public function getAuthors()
  16439. {
  16440. return $this->authors;
  16441. }
  16442. public function setDescription($description)
  16443. {
  16444. $this->description = $description;
  16445. }
  16446. public function getDescription()
  16447. {
  16448. return $this->description;
  16449. }
  16450. public function setHomepage($homepage)
  16451. {
  16452. $this->homepage = $homepage;
  16453. }
  16454. public function getHomepage()
  16455. {
  16456. return $this->homepage;
  16457. }
  16458. public function setSupport(array $support)
  16459. {
  16460. $this->support = $support;
  16461. }
  16462. public function getSupport()
  16463. {
  16464. return $this->support;
  16465. }
  16466. public function isAbandoned()
  16467. {
  16468. return (bool) $this->abandoned;
  16469. }
  16470. public function setAbandoned($abandoned)
  16471. {
  16472. $this->abandoned = $abandoned;
  16473. }
  16474. public function getReplacementPackage()
  16475. {
  16476. return is_string($this->abandoned) ? $this->abandoned : null;
  16477. }
  16478. }
  16479. <?php
  16480. namespace Composer\Package;
  16481. interface CompletePackageInterface extends PackageInterface
  16482. {
  16483. public function getScripts();
  16484. public function getRepositories();
  16485. public function getLicense();
  16486. public function getKeywords();
  16487. public function getDescription();
  16488. public function getHomepage();
  16489. public function getAuthors();
  16490. public function getSupport();
  16491. public function isAbandoned();
  16492. public function getReplacementPackage();
  16493. }
  16494. <?php
  16495. namespace Composer\Package\Dumper;
  16496. use Composer\Package\BasePackage;
  16497. use Composer\Package\PackageInterface;
  16498. use Composer\Package\CompletePackageInterface;
  16499. use Composer\Package\RootPackageInterface;
  16500. class ArrayDumper
  16501. {
  16502. public function dump(PackageInterface $package)
  16503. {
  16504. $keys = array(
  16505. 'binaries' => 'bin',
  16506. 'type',
  16507. 'extra',
  16508. 'installationSource' => 'installation-source',
  16509. 'autoload',
  16510. 'devAutoload' => 'autoload-dev',
  16511. 'notificationUrl' => 'notification-url',
  16512. 'includePaths' => 'include-path',
  16513. );
  16514. $data = array();
  16515. $data['name'] = $package->getPrettyName();
  16516. $data['version'] = $package->getPrettyVersion();
  16517. $data['version_normalized'] = $package->getVersion();
  16518. if ($package->getTargetDir()) {
  16519. $data['target-dir'] = $package->getTargetDir();
  16520. }
  16521. if ($package->getSourceType()) {
  16522. $data['source']['type'] = $package->getSourceType();
  16523. $data['source']['url'] = $package->getSourceUrl();
  16524. $data['source']['reference'] = $package->getSourceReference();
  16525. if ($mirrors = $package->getSourceMirrors()) {
  16526. $data['source']['mirrors'] = $mirrors;
  16527. }
  16528. }
  16529. if ($package->getDistType()) {
  16530. $data['dist']['type'] = $package->getDistType();
  16531. $data['dist']['url'] = $package->getDistUrl();
  16532. $data['dist']['reference'] = $package->getDistReference();
  16533. $data['dist']['shasum'] = $package->getDistSha1Checksum();
  16534. if ($mirrors = $package->getDistMirrors()) {
  16535. $data['dist']['mirrors'] = $mirrors;
  16536. }
  16537. }
  16538. if ($package->getArchiveExcludes()) {
  16539. $data['archive']['exclude'] = $package->getArchiveExcludes();
  16540. }
  16541. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  16542. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  16543. foreach ($links as $link) {
  16544. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  16545. }
  16546. ksort($data[$type]);
  16547. }
  16548. }
  16549. if ($packages = $package->getSuggests()) {
  16550. ksort($packages);
  16551. $data['suggest'] = $packages;
  16552. }
  16553. if ($package->getReleaseDate()) {
  16554. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  16555. }
  16556. $data = $this->dumpValues($package, $keys, $data);
  16557. if ($package instanceof CompletePackageInterface) {
  16558. $keys = array(
  16559. 'scripts',
  16560. 'license',
  16561. 'authors',
  16562. 'description',
  16563. 'homepage',
  16564. 'keywords',
  16565. 'repositories',
  16566. 'support',
  16567. );
  16568. $data = $this->dumpValues($package, $keys, $data);
  16569. if (isset($data['keywords']) && is_array($data['keywords'])) {
  16570. sort($data['keywords']);
  16571. }
  16572. if ($package->isAbandoned()) {
  16573. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  16574. }
  16575. }
  16576. if ($package instanceof RootPackageInterface) {
  16577. $minimumStability = $package->getMinimumStability();
  16578. if ($minimumStability) {
  16579. $data['minimum-stability'] = $minimumStability;
  16580. }
  16581. }
  16582. if (count($package->getTransportOptions()) > 0) {
  16583. $data['transport-options'] = $package->getTransportOptions();
  16584. }
  16585. return $data;
  16586. }
  16587. private function dumpValues(PackageInterface $package, array $keys, array $data)
  16588. {
  16589. foreach ($keys as $method => $key) {
  16590. if (is_numeric($method)) {
  16591. $method = $key;
  16592. }
  16593. $getter = 'get'.ucfirst($method);
  16594. $value = $package->$getter();
  16595. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  16596. $data[$key] = $value;
  16597. }
  16598. }
  16599. return $data;
  16600. }
  16601. }
  16602. <?php
  16603. namespace Composer\Package;
  16604. use Composer\Semver\Constraint\ConstraintInterface;
  16605. class Link
  16606. {
  16607. protected $source;
  16608. protected $target;
  16609. protected $constraint;
  16610. protected $description;
  16611. protected $prettyConstraint;
  16612. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  16613. {
  16614. $this->source = strtolower($source);
  16615. $this->target = strtolower($target);
  16616. $this->constraint = $constraint;
  16617. $this->description = $description;
  16618. $this->prettyConstraint = $prettyConstraint;
  16619. }
  16620. public function getDescription()
  16621. {
  16622. return $this->description;
  16623. }
  16624. public function getSource()
  16625. {
  16626. return $this->source;
  16627. }
  16628. public function getTarget()
  16629. {
  16630. return $this->target;
  16631. }
  16632. public function getConstraint()
  16633. {
  16634. return $this->constraint;
  16635. }
  16636. public function getPrettyConstraint()
  16637. {
  16638. if (null === $this->prettyConstraint) {
  16639. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  16640. }
  16641. return $this->prettyConstraint;
  16642. }
  16643. public function __toString()
  16644. {
  16645. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  16646. }
  16647. public function getPrettyString(PackageInterface $sourcePackage)
  16648. {
  16649. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  16650. }
  16651. }
  16652. <?php
  16653. namespace Composer\Package\LinkConstraint;
  16654. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  16655. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  16656. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  16657. {
  16658. }
  16659. <?php
  16660. namespace Composer\Package\LinkConstraint;
  16661. use Composer\Semver\Constraint\ConstraintInterface;
  16662. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  16663. interface LinkConstraintInterface extends ConstraintInterface
  16664. {
  16665. }
  16666. <?php
  16667. namespace Composer\Package\LinkConstraint;
  16668. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  16669. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  16670. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  16671. {
  16672. }
  16673. <?php
  16674. namespace Composer\Package\LinkConstraint;
  16675. use Composer\Semver\Constraint\AbstractConstraint;
  16676. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  16677. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  16678. {
  16679. }
  16680. <?php
  16681. namespace Composer\Package\LinkConstraint;
  16682. use Composer\Semver\Constraint\Constraint;
  16683. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  16684. class VersionConstraint extends Constraint implements LinkConstraintInterface
  16685. {
  16686. }
  16687. <?php
  16688. namespace Composer\Package\Loader;
  16689. use Composer\Package;
  16690. use Composer\Package\AliasPackage;
  16691. use Composer\Package\Link;
  16692. use Composer\Package\RootAliasPackage;
  16693. use Composer\Package\RootPackageInterface;
  16694. use Composer\Package\Version\VersionParser;
  16695. use Composer\Semver\VersionParser as SemverVersionParser;
  16696. class ArrayLoader implements LoaderInterface
  16697. {
  16698. protected $versionParser;
  16699. protected $loadOptions;
  16700. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  16701. {
  16702. if (!$parser) {
  16703. $parser = new VersionParser;
  16704. }
  16705. $this->versionParser = $parser;
  16706. $this->loadOptions = $loadOptions;
  16707. }
  16708. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  16709. {
  16710. if (!isset($config['name'])) {
  16711. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  16712. }
  16713. if (!isset($config['version'])) {
  16714. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  16715. }
  16716. if (isset($config['version_normalized'])) {
  16717. $version = $config['version_normalized'];
  16718. } else {
  16719. $version = $this->versionParser->normalize($config['version']);
  16720. }
  16721. $package = new $class($config['name'], $version, $config['version']);
  16722. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  16723. if (isset($config['target-dir'])) {
  16724. $package->setTargetDir($config['target-dir']);
  16725. }
  16726. if (isset($config['extra']) && is_array($config['extra'])) {
  16727. $package->setExtra($config['extra']);
  16728. }
  16729. if (isset($config['bin'])) {
  16730. foreach ((array) $config['bin'] as $key => $bin) {
  16731. $config['bin'][$key] = ltrim($bin, '/');
  16732. }
  16733. $package->setBinaries((array) $config['bin']);
  16734. }
  16735. if (isset($config['installation-source'])) {
  16736. $package->setInstallationSource($config['installation-source']);
  16737. }
  16738. if (isset($config['source'])) {
  16739. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  16740. throw new \UnexpectedValueException(sprintf(
  16741. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  16742. $config['name'],
  16743. json_encode($config['source'])
  16744. ));
  16745. }
  16746. $package->setSourceType($config['source']['type']);
  16747. $package->setSourceUrl($config['source']['url']);
  16748. $package->setSourceReference($config['source']['reference']);
  16749. if (isset($config['source']['mirrors'])) {
  16750. $package->setSourceMirrors($config['source']['mirrors']);
  16751. }
  16752. }
  16753. if (isset($config['dist'])) {
  16754. if (!isset($config['dist']['type'])
  16755. || !isset($config['dist']['url'])) {
  16756. throw new \UnexpectedValueException(sprintf(
  16757. "Package %s's dist key should be specified as ".
  16758. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  16759. $config['name'],
  16760. json_encode($config['dist'])
  16761. ));
  16762. }
  16763. $package->setDistType($config['dist']['type']);
  16764. $package->setDistUrl($config['dist']['url']);
  16765. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  16766. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  16767. if (isset($config['dist']['mirrors'])) {
  16768. $package->setDistMirrors($config['dist']['mirrors']);
  16769. }
  16770. }
  16771. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  16772. if (isset($config[$type])) {
  16773. $method = 'set'.ucfirst($opts['method']);
  16774. $package->{$method}(
  16775. $this->parseLinks(
  16776. $package->getName(),
  16777. $package->getPrettyVersion(),
  16778. $opts['description'],
  16779. $config[$type]
  16780. )
  16781. );
  16782. }
  16783. }
  16784. if (isset($config['suggest']) && is_array($config['suggest'])) {
  16785. foreach ($config['suggest'] as $target => $reason) {
  16786. if ('self.version' === trim($reason)) {
  16787. $config['suggest'][$target] = $package->getPrettyVersion();
  16788. }
  16789. }
  16790. $package->setSuggests($config['suggest']);
  16791. }
  16792. if (isset($config['autoload'])) {
  16793. $package->setAutoload($config['autoload']);
  16794. }
  16795. if (isset($config['autoload-dev'])) {
  16796. $package->setDevAutoload($config['autoload-dev']);
  16797. }
  16798. if (isset($config['include-path'])) {
  16799. $package->setIncludePaths($config['include-path']);
  16800. }
  16801. if (!empty($config['time'])) {
  16802. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  16803. try {
  16804. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  16805. $package->setReleaseDate($date);
  16806. } catch (\Exception $e) {
  16807. }
  16808. }
  16809. if (!empty($config['notification-url'])) {
  16810. $package->setNotificationUrl($config['notification-url']);
  16811. }
  16812. if (!empty($config['archive']['exclude'])) {
  16813. $package->setArchiveExcludes($config['archive']['exclude']);
  16814. }
  16815. if ($package instanceof Package\CompletePackageInterface) {
  16816. if (isset($config['scripts']) && is_array($config['scripts'])) {
  16817. foreach ($config['scripts'] as $event => $listeners) {
  16818. $config['scripts'][$event] = (array) $listeners;
  16819. }
  16820. if (isset($config['scripts']['composer'])) {
  16821. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  16822. }
  16823. $package->setScripts($config['scripts']);
  16824. }
  16825. if (!empty($config['description']) && is_string($config['description'])) {
  16826. $package->setDescription($config['description']);
  16827. }
  16828. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  16829. $package->setHomepage($config['homepage']);
  16830. }
  16831. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  16832. $package->setKeywords($config['keywords']);
  16833. }
  16834. if (!empty($config['license'])) {
  16835. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  16836. }
  16837. if (!empty($config['authors']) && is_array($config['authors'])) {
  16838. $package->setAuthors($config['authors']);
  16839. }
  16840. if (isset($config['support'])) {
  16841. $package->setSupport($config['support']);
  16842. }
  16843. if (isset($config['abandoned'])) {
  16844. $package->setAbandoned($config['abandoned']);
  16845. }
  16846. }
  16847. if ($aliasNormalized = $this->getBranchAlias($config)) {
  16848. if ($package instanceof RootPackageInterface) {
  16849. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  16850. } else {
  16851. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  16852. }
  16853. }
  16854. if ($this->loadOptions && isset($config['transport-options'])) {
  16855. $package->setTransportOptions($config['transport-options']);
  16856. }
  16857. return $package;
  16858. }
  16859. public function parseLinks($source, $sourceVersion, $description, $links)
  16860. {
  16861. $res = array();
  16862. foreach ($links as $target => $constraint) {
  16863. if (!is_string($constraint)) {
  16864. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  16865. }
  16866. if ('self.version' === $constraint) {
  16867. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  16868. } else {
  16869. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  16870. }
  16871. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  16872. }
  16873. return $res;
  16874. }
  16875. public function getBranchAlias(array $config)
  16876. {
  16877. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  16878. || !isset($config['extra']['branch-alias'])
  16879. || !is_array($config['extra']['branch-alias'])
  16880. ) {
  16881. return;
  16882. }
  16883. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  16884. if ('-dev' !== substr($targetBranch, -4)) {
  16885. continue;
  16886. }
  16887. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  16888. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  16889. continue;
  16890. }
  16891. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  16892. continue;
  16893. }
  16894. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  16895. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  16896. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  16897. ) {
  16898. continue;
  16899. }
  16900. return $validatedTargetBranch;
  16901. }
  16902. }
  16903. }
  16904. <?php
  16905. namespace Composer\Package\Loader;
  16906. class InvalidPackageException extends \Exception
  16907. {
  16908. private $errors;
  16909. private $warnings;
  16910. private $data;
  16911. public function __construct(array $errors, array $warnings, array $data)
  16912. {
  16913. $this->errors = $errors;
  16914. $this->warnings = $warnings;
  16915. $this->data = $data;
  16916. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  16917. }
  16918. public function getData()
  16919. {
  16920. return $this->data;
  16921. }
  16922. public function getErrors()
  16923. {
  16924. return $this->errors;
  16925. }
  16926. public function getWarnings()
  16927. {
  16928. return $this->warnings;
  16929. }
  16930. }
  16931. <?php
  16932. namespace Composer\Package\Loader;
  16933. use Composer\Json\JsonFile;
  16934. class JsonLoader
  16935. {
  16936. private $loader;
  16937. public function __construct(LoaderInterface $loader)
  16938. {
  16939. $this->loader = $loader;
  16940. }
  16941. public function load($json)
  16942. {
  16943. if ($json instanceof JsonFile) {
  16944. $config = $json->read();
  16945. } elseif (file_exists($json)) {
  16946. $config = JsonFile::parseJson(file_get_contents($json), $json);
  16947. } elseif (is_string($json)) {
  16948. $config = JsonFile::parseJson($json);
  16949. }
  16950. return $this->loader->load($config);
  16951. }
  16952. }
  16953. <?php
  16954. namespace Composer\Package\Loader;
  16955. interface LoaderInterface
  16956. {
  16957. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  16958. }
  16959. <?php
  16960. namespace Composer\Package\Loader;
  16961. use Composer\Package\BasePackage;
  16962. use Composer\Package\AliasPackage;
  16963. use Composer\Config;
  16964. use Composer\Package\RootPackageInterface;
  16965. use Composer\Repository\RepositoryFactory;
  16966. use Composer\Package\Version\VersionGuesser;
  16967. use Composer\Package\Version\VersionParser;
  16968. use Composer\Repository\RepositoryManager;
  16969. use Composer\Util\ProcessExecutor;
  16970. class RootPackageLoader extends ArrayLoader
  16971. {
  16972. private $manager;
  16973. private $config;
  16974. private $versionGuesser;
  16975. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null)
  16976. {
  16977. parent::__construct($parser);
  16978. $this->manager = $manager;
  16979. $this->config = $config;
  16980. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  16981. }
  16982. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  16983. {
  16984. if (!isset($config['name'])) {
  16985. $config['name'] = '__root__';
  16986. }
  16987. $autoVersioned = false;
  16988. if (!isset($config['version'])) {
  16989. $commit = null;
  16990. if (getenv('COMPOSER_ROOT_VERSION')) {
  16991. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  16992. } else {
  16993. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  16994. if ($versionData) {
  16995. $config['version'] = $versionData['pretty_version'];
  16996. $config['version_normalized'] = $versionData['version'];
  16997. $commit = $versionData['commit'];
  16998. }
  16999. }
  17000. if (!isset($config['version'])) {
  17001. $config['version'] = '1.0.0';
  17002. $autoVersioned = true;
  17003. }
  17004. if ($commit) {
  17005. $config['source'] = array(
  17006. 'type' => '',
  17007. 'url' => '',
  17008. 'reference' => $commit,
  17009. );
  17010. $config['dist'] = array(
  17011. 'type' => '',
  17012. 'url' => '',
  17013. 'reference' => $commit,
  17014. );
  17015. }
  17016. }
  17017. $realPackage = $package = parent::load($config, $class);
  17018. if ($realPackage instanceof AliasPackage) {
  17019. $realPackage = $package->getAliasOf();
  17020. }
  17021. if ($autoVersioned) {
  17022. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  17023. }
  17024. if (isset($config['minimum-stability'])) {
  17025. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  17026. }
  17027. $aliases = array();
  17028. $stabilityFlags = array();
  17029. $references = array();
  17030. foreach (array('require', 'require-dev') as $linkType) {
  17031. if (isset($config[$linkType])) {
  17032. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  17033. $method = 'get'.ucfirst($linkInfo['method']);
  17034. $links = array();
  17035. foreach ($realPackage->$method() as $link) {
  17036. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  17037. }
  17038. $aliases = $this->extractAliases($links, $aliases);
  17039. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  17040. $references = $this->extractReferences($links, $references);
  17041. }
  17042. }
  17043. if (isset($links[$config['name']])) {
  17044. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  17045. 'Did you accidentally name your root package after an external package?', $config['name']));
  17046. }
  17047. $realPackage->setAliases($aliases);
  17048. $realPackage->setStabilityFlags($stabilityFlags);
  17049. $realPackage->setReferences($references);
  17050. if (isset($config['prefer-stable'])) {
  17051. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  17052. }
  17053. if (isset($config['config'])) {
  17054. $realPackage->setConfig($config['config']);
  17055. }
  17056. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  17057. foreach ($repos as $repo) {
  17058. $this->manager->addRepository($repo);
  17059. }
  17060. $realPackage->setRepositories($this->config->getRepositories());
  17061. return $package;
  17062. }
  17063. private function extractAliases(array $requires, array $aliases)
  17064. {
  17065. foreach ($requires as $reqName => $reqVersion) {
  17066. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  17067. $aliases[] = array(
  17068. 'package' => strtolower($reqName),
  17069. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  17070. 'alias' => $match[2],
  17071. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  17072. );
  17073. }
  17074. }
  17075. return $aliases;
  17076. }
  17077. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  17078. {
  17079. $stabilities = BasePackage::$stabilities;
  17080. $minimumStability = $stabilities[$minimumStability];
  17081. foreach ($requires as $reqName => $reqVersion) {
  17082. $constraints = array();
  17083. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  17084. foreach ($orSplit as $orConstraint) {
  17085. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  17086. foreach ($andSplit as $andConstraint) {
  17087. $constraints[] = $andConstraint;
  17088. }
  17089. }
  17090. $match = false;
  17091. foreach ($constraints as $constraint) {
  17092. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  17093. $name = strtolower($reqName);
  17094. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  17095. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  17096. continue;
  17097. }
  17098. $stabilityFlags[$name] = $stability;
  17099. $match = true;
  17100. }
  17101. }
  17102. if ($match) {
  17103. continue;
  17104. }
  17105. foreach ($constraints as $constraint) {
  17106. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  17107. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  17108. $name = strtolower($reqName);
  17109. $stability = $stabilities[$stabilityName];
  17110. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  17111. continue;
  17112. }
  17113. $stabilityFlags[$name] = $stability;
  17114. }
  17115. }
  17116. }
  17117. return $stabilityFlags;
  17118. }
  17119. private function extractReferences(array $requires, array $references)
  17120. {
  17121. foreach ($requires as $reqName => $reqVersion) {
  17122. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  17123. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === ($stabilityName = VersionParser::parseStability($reqVersion))) {
  17124. $name = strtolower($reqName);
  17125. $references[$name] = $match[1];
  17126. }
  17127. }
  17128. return $references;
  17129. }
  17130. }
  17131. <?php
  17132. namespace Composer\Package\Loader;
  17133. use Composer\Package;
  17134. use Composer\Package\BasePackage;
  17135. use Composer\Semver\Constraint\Constraint;
  17136. use Composer\Package\Version\VersionParser;
  17137. use Composer\Repository\PlatformRepository;
  17138. use Composer\Spdx\SpdxLicenses;
  17139. class ValidatingArrayLoader implements LoaderInterface
  17140. {
  17141. const CHECK_ALL = 3;
  17142. const CHECK_UNBOUND_CONSTRAINTS = 1;
  17143. const CHECK_STRICT_CONSTRAINTS = 2;
  17144. private $loader;
  17145. private $versionParser;
  17146. private $errors;
  17147. private $warnings;
  17148. private $config;
  17149. private $strictName;
  17150. private $flags;
  17151. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  17152. {
  17153. $this->loader = $loader;
  17154. $this->versionParser = $parser ?: new VersionParser();
  17155. $this->strictName = $strictName;
  17156. $this->flags = $flags;
  17157. }
  17158. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17159. {
  17160. $this->errors = array();
  17161. $this->warnings = array();
  17162. $this->config = $config;
  17163. if ($this->strictName) {
  17164. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  17165. } else {
  17166. $this->validateString('name', true);
  17167. }
  17168. if (!empty($this->config['version'])) {
  17169. try {
  17170. $this->versionParser->normalize($this->config['version']);
  17171. } catch (\Exception $e) {
  17172. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  17173. unset($this->config['version']);
  17174. }
  17175. }
  17176. if (!empty($this->config['config']['platform'])) {
  17177. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  17178. try {
  17179. $this->versionParser->normalize($platform);
  17180. } catch (\Exception $e) {
  17181. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  17182. }
  17183. }
  17184. }
  17185. $this->validateRegex('type', '[A-Za-z0-9-]+');
  17186. $this->validateString('target-dir');
  17187. $this->validateArray('extra');
  17188. if (isset($this->config['bin'])) {
  17189. if (is_string($this->config['bin'])) {
  17190. $this->validateString('bin');
  17191. } else {
  17192. $this->validateFlatArray('bin');
  17193. }
  17194. }
  17195. $this->validateArray('scripts');
  17196. $this->validateString('description');
  17197. $this->validateUrl('homepage');
  17198. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  17199. $releaseDate = null;
  17200. $this->validateString('time');
  17201. if (!empty($this->config['time'])) {
  17202. try {
  17203. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  17204. } catch (\Exception $e) {
  17205. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  17206. unset($this->config['time']);
  17207. }
  17208. }
  17209. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  17210. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  17211. $licenses = (array) $this->config['license'];
  17212. foreach ($licenses as $key => $license) {
  17213. if ('proprietary' === $license) {
  17214. unset($licenses[$key]);
  17215. }
  17216. }
  17217. $licenseValidator = new SpdxLicenses();
  17218. if (count($licenses) === 1 && !$licenseValidator->validate($licenses) && $licenseValidator->validate(trim($licenses[0]))) {
  17219. $this->warnings[] = sprintf(
  17220. 'License %s must not contain extra spaces, make sure to trim it.',
  17221. json_encode($this->config['license'])
  17222. );
  17223. } elseif (array() !== $licenses && !$licenseValidator->validate($licenses)) {
  17224. $this->warnings[] = sprintf(
  17225. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  17226. 'If the software is closed-source, you may use "proprietary" as license.',
  17227. json_encode($this->config['license'])
  17228. );
  17229. }
  17230. }
  17231. }
  17232. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  17233. foreach ($this->config['authors'] as $key => $author) {
  17234. if (!is_array($author)) {
  17235. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  17236. unset($this->config['authors'][$key]);
  17237. continue;
  17238. }
  17239. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  17240. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  17241. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  17242. unset($this->config['authors'][$key][$authorData]);
  17243. }
  17244. }
  17245. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  17246. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  17247. unset($this->config['authors'][$key]['homepage']);
  17248. }
  17249. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  17250. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  17251. unset($this->config['authors'][$key]['email']);
  17252. }
  17253. if (empty($this->config['authors'][$key])) {
  17254. unset($this->config['authors'][$key]);
  17255. }
  17256. }
  17257. if (empty($this->config['authors'])) {
  17258. unset($this->config['authors']);
  17259. }
  17260. }
  17261. if ($this->validateArray('support') && !empty($this->config['support'])) {
  17262. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss') as $key) {
  17263. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  17264. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  17265. unset($this->config['support'][$key]);
  17266. }
  17267. }
  17268. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  17269. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  17270. unset($this->config['support']['email']);
  17271. }
  17272. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  17273. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  17274. unset($this->config['support']['irc']);
  17275. }
  17276. foreach (array('issues', 'forum', 'wiki', 'source', 'docs') as $key) {
  17277. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  17278. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  17279. unset($this->config['support'][$key]);
  17280. }
  17281. }
  17282. if (empty($this->config['support'])) {
  17283. unset($this->config['support']);
  17284. }
  17285. }
  17286. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  17287. $stableConstraint = new Constraint('=', '1.0.0');
  17288. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  17289. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  17290. foreach ($this->config[$linkType] as $package => $constraint) {
  17291. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  17292. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  17293. }
  17294. if (!is_string($constraint)) {
  17295. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  17296. unset($this->config[$linkType][$package]);
  17297. } elseif ('self.version' !== $constraint) {
  17298. try {
  17299. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  17300. } catch (\Exception $e) {
  17301. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  17302. unset($this->config[$linkType][$package]);
  17303. continue;
  17304. }
  17305. if (
  17306. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  17307. && 'require' === $linkType
  17308. && $linkConstraint->matches($unboundConstraint)
  17309. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  17310. ) {
  17311. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  17312. } elseif (
  17313. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  17314. && 'require' === $linkType
  17315. && substr($linkConstraint, 0, 1) === '='
  17316. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  17317. ) {
  17318. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  17319. }
  17320. }
  17321. }
  17322. }
  17323. }
  17324. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  17325. foreach ($this->config['suggest'] as $package => $description) {
  17326. if (!is_string($description)) {
  17327. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  17328. unset($this->config['suggest'][$package]);
  17329. }
  17330. }
  17331. }
  17332. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  17333. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  17334. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  17335. unset($this->config['minimum-stability']);
  17336. }
  17337. }
  17338. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  17339. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  17340. foreach ($this->config['autoload'] as $type => $typeConfig) {
  17341. if (!in_array($type, $types)) {
  17342. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  17343. unset($this->config['autoload'][$type]);
  17344. }
  17345. if ($type === 'psr-4') {
  17346. foreach ($typeConfig as $namespace => $dirs) {
  17347. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  17348. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  17349. }
  17350. }
  17351. }
  17352. }
  17353. }
  17354. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  17355. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  17356. unset($this->config['autoload']['psr-4']);
  17357. }
  17358. $this->validateFlatArray('include-path');
  17359. $this->validateArray('transport-options');
  17360. if (isset($this->config['extra']['branch-alias'])) {
  17361. if (!is_array($this->config['extra']['branch-alias'])) {
  17362. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  17363. } else {
  17364. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  17365. if ('-dev' !== substr($targetBranch, -4)) {
  17366. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  17367. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17368. continue;
  17369. }
  17370. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  17371. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  17372. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  17373. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17374. continue;
  17375. }
  17376. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  17377. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  17378. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  17379. ) {
  17380. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  17381. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17382. }
  17383. }
  17384. }
  17385. }
  17386. if ($this->errors) {
  17387. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  17388. }
  17389. $package = $this->loader->load($this->config, $class);
  17390. $this->config = null;
  17391. return $package;
  17392. }
  17393. public function getWarnings()
  17394. {
  17395. return $this->warnings;
  17396. }
  17397. public function getErrors()
  17398. {
  17399. return $this->errors;
  17400. }
  17401. private function validateRegex($property, $regex, $mandatory = false)
  17402. {
  17403. if (!$this->validateString($property, $mandatory)) {
  17404. return false;
  17405. }
  17406. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  17407. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  17408. if ($mandatory) {
  17409. $this->errors[] = $message;
  17410. } else {
  17411. $this->warnings[] = $message;
  17412. }
  17413. unset($this->config[$property]);
  17414. return false;
  17415. }
  17416. return true;
  17417. }
  17418. private function validateString($property, $mandatory = false)
  17419. {
  17420. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  17421. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  17422. unset($this->config[$property]);
  17423. return false;
  17424. }
  17425. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  17426. if ($mandatory) {
  17427. $this->errors[] = $property.' : must be present';
  17428. }
  17429. unset($this->config[$property]);
  17430. return false;
  17431. }
  17432. return true;
  17433. }
  17434. private function validateArray($property, $mandatory = false)
  17435. {
  17436. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  17437. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  17438. unset($this->config[$property]);
  17439. return false;
  17440. }
  17441. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  17442. if ($mandatory) {
  17443. $this->errors[] = $property.' : must be present and contain at least one element';
  17444. }
  17445. unset($this->config[$property]);
  17446. return false;
  17447. }
  17448. return true;
  17449. }
  17450. private function validateFlatArray($property, $regex = null, $mandatory = false)
  17451. {
  17452. if (!$this->validateArray($property, $mandatory)) {
  17453. return false;
  17454. }
  17455. $pass = true;
  17456. foreach ($this->config[$property] as $key => $value) {
  17457. if (!is_string($value) && !is_numeric($value)) {
  17458. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  17459. unset($this->config[$property][$key]);
  17460. $pass = false;
  17461. continue;
  17462. }
  17463. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  17464. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  17465. unset($this->config[$property][$key]);
  17466. $pass = false;
  17467. }
  17468. }
  17469. return $pass;
  17470. }
  17471. private function validateUrl($property, $mandatory = false)
  17472. {
  17473. if (!$this->validateString($property, $mandatory)) {
  17474. return false;
  17475. }
  17476. if (!$this->filterUrl($this->config[$property])) {
  17477. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  17478. unset($this->config[$property]);
  17479. return false;
  17480. }
  17481. return true;
  17482. }
  17483. private function filterUrl($value, array $schemes = array('http', 'https'))
  17484. {
  17485. if ($value === '') {
  17486. return true;
  17487. }
  17488. $bits = parse_url($value);
  17489. if (empty($bits['scheme']) || empty($bits['host'])) {
  17490. return false;
  17491. }
  17492. if (!in_array($bits['scheme'], $schemes, true)) {
  17493. return false;
  17494. }
  17495. return true;
  17496. }
  17497. }
  17498. <?php
  17499. namespace Composer\Package;
  17500. use Composer\Json\JsonFile;
  17501. use Composer\Installer\InstallationManager;
  17502. use Composer\Repository\RepositoryManager;
  17503. use Composer\Util\ProcessExecutor;
  17504. use Composer\Repository\ArrayRepository;
  17505. use Composer\Package\Dumper\ArrayDumper;
  17506. use Composer\Package\Loader\ArrayLoader;
  17507. use Composer\Util\Git as GitUtil;
  17508. use Composer\IO\IOInterface;
  17509. use Seld\JsonLint\ParsingException;
  17510. class Locker
  17511. {
  17512. private $lockFile;
  17513. private $repositoryManager;
  17514. private $installationManager;
  17515. private $hash;
  17516. private $contentHash;
  17517. private $loader;
  17518. private $dumper;
  17519. private $process;
  17520. private $lockDataCache;
  17521. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  17522. {
  17523. $this->lockFile = $lockFile;
  17524. $this->repositoryManager = $repositoryManager;
  17525. $this->installationManager = $installationManager;
  17526. $this->hash = md5($composerFileContents);
  17527. $this->contentHash = self::getContentHash($composerFileContents);
  17528. $this->loader = new ArrayLoader(null, true);
  17529. $this->dumper = new ArrayDumper();
  17530. $this->process = new ProcessExecutor($io);
  17531. }
  17532. public static function getContentHash($composerFileContents)
  17533. {
  17534. $content = json_decode($composerFileContents, true);
  17535. $relevantKeys = array(
  17536. 'name',
  17537. 'version',
  17538. 'require',
  17539. 'require-dev',
  17540. 'conflict',
  17541. 'replace',
  17542. 'provide',
  17543. 'minimum-stability',
  17544. 'prefer-stable',
  17545. 'repositories',
  17546. 'extra',
  17547. );
  17548. $relevantContent = array();
  17549. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  17550. $relevantContent[$key] = $content[$key];
  17551. }
  17552. if (isset($content['config']['platform'])) {
  17553. $relevantContent['config']['platform'] = $content['config']['platform'];
  17554. }
  17555. ksort($relevantContent);
  17556. return md5(json_encode($relevantContent));
  17557. }
  17558. public function isLocked()
  17559. {
  17560. if (!$this->lockFile->exists()) {
  17561. return false;
  17562. }
  17563. $data = $this->getLockData();
  17564. return isset($data['packages']);
  17565. }
  17566. public function isFresh()
  17567. {
  17568. $lock = $this->lockFile->read();
  17569. if (!empty($lock['content-hash'])) {
  17570. return $this->contentHash === $lock['content-hash'];
  17571. }
  17572. if (!empty($lock['hash'])) {
  17573. return $this->hash === $lock['hash'];
  17574. }
  17575. return false;
  17576. }
  17577. public function getLockedRepository($withDevReqs = false)
  17578. {
  17579. $lockData = $this->getLockData();
  17580. $packages = new ArrayRepository();
  17581. $lockedPackages = $lockData['packages'];
  17582. if ($withDevReqs) {
  17583. if (isset($lockData['packages-dev'])) {
  17584. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  17585. } else {
  17586. 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.');
  17587. }
  17588. }
  17589. if (empty($lockedPackages)) {
  17590. return $packages;
  17591. }
  17592. if (isset($lockedPackages[0]['name'])) {
  17593. foreach ($lockedPackages as $info) {
  17594. $packages->addPackage($this->loader->load($info));
  17595. }
  17596. return $packages;
  17597. }
  17598. 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.');
  17599. }
  17600. public function getPlatformRequirements($withDevReqs = false)
  17601. {
  17602. $lockData = $this->getLockData();
  17603. $requirements = array();
  17604. if (!empty($lockData['platform'])) {
  17605. $requirements = $this->loader->parseLinks(
  17606. '__ROOT__',
  17607. '1.0.0',
  17608. 'requires',
  17609. isset($lockData['platform']) ? $lockData['platform'] : array()
  17610. );
  17611. }
  17612. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  17613. $devRequirements = $this->loader->parseLinks(
  17614. '__ROOT__',
  17615. '1.0.0',
  17616. 'requires',
  17617. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  17618. );
  17619. $requirements = array_merge($requirements, $devRequirements);
  17620. }
  17621. return $requirements;
  17622. }
  17623. public function getMinimumStability()
  17624. {
  17625. $lockData = $this->getLockData();
  17626. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  17627. }
  17628. public function getStabilityFlags()
  17629. {
  17630. $lockData = $this->getLockData();
  17631. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  17632. }
  17633. public function getPreferStable()
  17634. {
  17635. $lockData = $this->getLockData();
  17636. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  17637. }
  17638. public function getPreferLowest()
  17639. {
  17640. $lockData = $this->getLockData();
  17641. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  17642. }
  17643. public function getPlatformOverrides()
  17644. {
  17645. $lockData = $this->getLockData();
  17646. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  17647. }
  17648. public function getAliases()
  17649. {
  17650. $lockData = $this->getLockData();
  17651. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  17652. }
  17653. public function getLockData()
  17654. {
  17655. if (null !== $this->lockDataCache) {
  17656. return $this->lockDataCache;
  17657. }
  17658. if (!$this->lockFile->exists()) {
  17659. throw new \LogicException('No lockfile found. Unable to read locked packages');
  17660. }
  17661. return $this->lockDataCache = $this->lockFile->read();
  17662. }
  17663. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  17664. {
  17665. $lock = array(
  17666. '_readme' => array('This file locks the dependencies of your project to a known state',
  17667. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file',
  17668. 'This file is @gener'.'ated automatically', ),
  17669. 'content-hash' => $this->contentHash,
  17670. 'packages' => null,
  17671. 'packages-dev' => null,
  17672. 'aliases' => array(),
  17673. 'minimum-stability' => $minimumStability,
  17674. 'stability-flags' => $stabilityFlags,
  17675. 'prefer-stable' => $preferStable,
  17676. 'prefer-lowest' => $preferLowest,
  17677. );
  17678. foreach ($aliases as $package => $versions) {
  17679. foreach ($versions as $version => $alias) {
  17680. $lock['aliases'][] = array(
  17681. 'alias' => $alias['alias'],
  17682. 'alias_normalized' => $alias['alias_normalized'],
  17683. 'version' => $version,
  17684. 'package' => $package,
  17685. );
  17686. }
  17687. }
  17688. $lock['packages'] = $this->lockPackages($packages);
  17689. if (null !== $devPackages) {
  17690. $lock['packages-dev'] = $this->lockPackages($devPackages);
  17691. }
  17692. $lock['platform'] = $platformReqs;
  17693. $lock['platform-dev'] = $platformDevReqs;
  17694. if ($platformOverrides) {
  17695. $lock['platform-overrides'] = $platformOverrides;
  17696. }
  17697. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  17698. if ($this->lockFile->exists()) {
  17699. unlink($this->lockFile->getPath());
  17700. }
  17701. return false;
  17702. }
  17703. try {
  17704. $isLocked = $this->isLocked();
  17705. } catch (ParsingException $e) {
  17706. $isLocked = false;
  17707. }
  17708. if (!$isLocked || $lock !== $this->getLockData()) {
  17709. $this->lockFile->write($lock);
  17710. $this->lockDataCache = null;
  17711. return true;
  17712. }
  17713. return false;
  17714. }
  17715. private function lockPackages(array $packages)
  17716. {
  17717. $locked = array();
  17718. foreach ($packages as $package) {
  17719. if ($package instanceof AliasPackage) {
  17720. continue;
  17721. }
  17722. $name = $package->getPrettyName();
  17723. $version = $package->getPrettyVersion();
  17724. if (!$name || !$version) {
  17725. throw new \LogicException(sprintf(
  17726. 'Package "%s" has no version or name and can not be locked', $package
  17727. ));
  17728. }
  17729. $spec = $this->dumper->dump($package);
  17730. unset($spec['version_normalized']);
  17731. $time = isset($spec['time']) ? $spec['time'] : null;
  17732. unset($spec['time']);
  17733. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  17734. $time = $this->getPackageTime($package) ?: $time;
  17735. }
  17736. if (null !== $time) {
  17737. $spec['time'] = $time;
  17738. }
  17739. unset($spec['installation-source']);
  17740. $locked[] = $spec;
  17741. }
  17742. usort($locked, function ($a, $b) {
  17743. $comparison = strcmp($a['name'], $b['name']);
  17744. if (0 !== $comparison) {
  17745. return $comparison;
  17746. }
  17747. return strcmp($a['version'], $b['version']);
  17748. });
  17749. return $locked;
  17750. }
  17751. private function getPackageTime(PackageInterface $package)
  17752. {
  17753. if (!function_exists('proc_open')) {
  17754. return null;
  17755. }
  17756. $path = realpath($this->installationManager->getInstallPath($package));
  17757. $sourceType = $package->getSourceType();
  17758. $datetime = null;
  17759. if ($path && in_array($sourceType, array('git', 'hg'))) {
  17760. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  17761. switch ($sourceType) {
  17762. case 'git':
  17763. GitUtil::cleanEnv();
  17764. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  17765. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  17766. }
  17767. break;
  17768. case 'hg':
  17769. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  17770. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  17771. }
  17772. break;
  17773. }
  17774. }
  17775. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  17776. }
  17777. }
  17778. <?php
  17779. namespace Composer\Package;
  17780. use Composer\Package\Version\VersionParser;
  17781. use Composer\Util\ComposerMirror;
  17782. class Package extends BasePackage
  17783. {
  17784. protected $type;
  17785. protected $targetDir;
  17786. protected $installationSource;
  17787. protected $sourceType;
  17788. protected $sourceUrl;
  17789. protected $sourceReference;
  17790. protected $sourceMirrors;
  17791. protected $distType;
  17792. protected $distUrl;
  17793. protected $distReference;
  17794. protected $distSha1Checksum;
  17795. protected $distMirrors;
  17796. protected $version;
  17797. protected $prettyVersion;
  17798. protected $releaseDate;
  17799. protected $extra = array();
  17800. protected $binaries = array();
  17801. protected $dev;
  17802. protected $stability;
  17803. protected $notificationUrl;
  17804. protected $requires = array();
  17805. protected $conflicts = array();
  17806. protected $provides = array();
  17807. protected $replaces = array();
  17808. protected $devRequires = array();
  17809. protected $suggests = array();
  17810. protected $autoload = array();
  17811. protected $devAutoload = array();
  17812. protected $includePaths = array();
  17813. protected $archiveExcludes = array();
  17814. public function __construct($name, $version, $prettyVersion)
  17815. {
  17816. parent::__construct($name);
  17817. $this->version = $version;
  17818. $this->prettyVersion = $prettyVersion;
  17819. $this->stability = VersionParser::parseStability($version);
  17820. $this->dev = $this->stability === 'dev';
  17821. }
  17822. public function isDev()
  17823. {
  17824. return $this->dev;
  17825. }
  17826. public function setType($type)
  17827. {
  17828. $this->type = $type;
  17829. }
  17830. public function getType()
  17831. {
  17832. return $this->type ?: 'library';
  17833. }
  17834. public function getStability()
  17835. {
  17836. return $this->stability;
  17837. }
  17838. public function setTargetDir($targetDir)
  17839. {
  17840. $this->targetDir = $targetDir;
  17841. }
  17842. public function getTargetDir()
  17843. {
  17844. if (null === $this->targetDir) {
  17845. return;
  17846. }
  17847. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  17848. }
  17849. public function setExtra(array $extra)
  17850. {
  17851. $this->extra = $extra;
  17852. }
  17853. public function getExtra()
  17854. {
  17855. return $this->extra;
  17856. }
  17857. public function setBinaries(array $binaries)
  17858. {
  17859. $this->binaries = $binaries;
  17860. }
  17861. public function getBinaries()
  17862. {
  17863. return $this->binaries;
  17864. }
  17865. public function setInstallationSource($type)
  17866. {
  17867. $this->installationSource = $type;
  17868. }
  17869. public function getInstallationSource()
  17870. {
  17871. return $this->installationSource;
  17872. }
  17873. public function setSourceType($type)
  17874. {
  17875. $this->sourceType = $type;
  17876. }
  17877. public function getSourceType()
  17878. {
  17879. return $this->sourceType;
  17880. }
  17881. public function setSourceUrl($url)
  17882. {
  17883. $this->sourceUrl = $url;
  17884. }
  17885. public function getSourceUrl()
  17886. {
  17887. return $this->sourceUrl;
  17888. }
  17889. public function setSourceReference($reference)
  17890. {
  17891. $this->sourceReference = $reference;
  17892. }
  17893. public function getSourceReference()
  17894. {
  17895. return $this->sourceReference;
  17896. }
  17897. public function setSourceMirrors($mirrors)
  17898. {
  17899. $this->sourceMirrors = $mirrors;
  17900. }
  17901. public function getSourceMirrors()
  17902. {
  17903. return $this->sourceMirrors;
  17904. }
  17905. public function getSourceUrls()
  17906. {
  17907. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  17908. }
  17909. public function setDistType($type)
  17910. {
  17911. $this->distType = $type;
  17912. }
  17913. public function getDistType()
  17914. {
  17915. return $this->distType;
  17916. }
  17917. public function setDistUrl($url)
  17918. {
  17919. $this->distUrl = $url;
  17920. }
  17921. public function getDistUrl()
  17922. {
  17923. return $this->distUrl;
  17924. }
  17925. public function setDistReference($reference)
  17926. {
  17927. $this->distReference = $reference;
  17928. }
  17929. public function getDistReference()
  17930. {
  17931. return $this->distReference;
  17932. }
  17933. public function setDistSha1Checksum($sha1checksum)
  17934. {
  17935. $this->distSha1Checksum = $sha1checksum;
  17936. }
  17937. public function getDistSha1Checksum()
  17938. {
  17939. return $this->distSha1Checksum;
  17940. }
  17941. public function setDistMirrors($mirrors)
  17942. {
  17943. $this->distMirrors = $mirrors;
  17944. }
  17945. public function getDistMirrors()
  17946. {
  17947. return $this->distMirrors;
  17948. }
  17949. public function getDistUrls()
  17950. {
  17951. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  17952. }
  17953. public function getVersion()
  17954. {
  17955. return $this->version;
  17956. }
  17957. public function getPrettyVersion()
  17958. {
  17959. return $this->prettyVersion;
  17960. }
  17961. public function setReleaseDate(\DateTime $releaseDate)
  17962. {
  17963. $this->releaseDate = $releaseDate;
  17964. }
  17965. public function getReleaseDate()
  17966. {
  17967. return $this->releaseDate;
  17968. }
  17969. public function setRequires(array $requires)
  17970. {
  17971. $this->requires = $requires;
  17972. }
  17973. public function getRequires()
  17974. {
  17975. return $this->requires;
  17976. }
  17977. public function setConflicts(array $conflicts)
  17978. {
  17979. $this->conflicts = $conflicts;
  17980. }
  17981. public function getConflicts()
  17982. {
  17983. return $this->conflicts;
  17984. }
  17985. public function setProvides(array $provides)
  17986. {
  17987. $this->provides = $provides;
  17988. }
  17989. public function getProvides()
  17990. {
  17991. return $this->provides;
  17992. }
  17993. public function setReplaces(array $replaces)
  17994. {
  17995. $this->replaces = $replaces;
  17996. }
  17997. public function getReplaces()
  17998. {
  17999. return $this->replaces;
  18000. }
  18001. public function setDevRequires(array $devRequires)
  18002. {
  18003. $this->devRequires = $devRequires;
  18004. }
  18005. public function getDevRequires()
  18006. {
  18007. return $this->devRequires;
  18008. }
  18009. public function setSuggests(array $suggests)
  18010. {
  18011. $this->suggests = $suggests;
  18012. }
  18013. public function getSuggests()
  18014. {
  18015. return $this->suggests;
  18016. }
  18017. public function setAutoload(array $autoload)
  18018. {
  18019. $this->autoload = $autoload;
  18020. }
  18021. public function getAutoload()
  18022. {
  18023. return $this->autoload;
  18024. }
  18025. public function setDevAutoload(array $devAutoload)
  18026. {
  18027. $this->devAutoload = $devAutoload;
  18028. }
  18029. public function getDevAutoload()
  18030. {
  18031. return $this->devAutoload;
  18032. }
  18033. public function setIncludePaths(array $includePaths)
  18034. {
  18035. $this->includePaths = $includePaths;
  18036. }
  18037. public function getIncludePaths()
  18038. {
  18039. return $this->includePaths;
  18040. }
  18041. public function setNotificationUrl($notificationUrl)
  18042. {
  18043. $this->notificationUrl = $notificationUrl;
  18044. }
  18045. public function getNotificationUrl()
  18046. {
  18047. return $this->notificationUrl;
  18048. }
  18049. public function setArchiveExcludes(array $excludes)
  18050. {
  18051. $this->archiveExcludes = $excludes;
  18052. }
  18053. public function getArchiveExcludes()
  18054. {
  18055. return $this->archiveExcludes;
  18056. }
  18057. public function replaceVersion($version, $prettyVersion)
  18058. {
  18059. $this->version = $version;
  18060. $this->prettyVersion = $prettyVersion;
  18061. $this->stability = VersionParser::parseStability($version);
  18062. $this->dev = $this->stability === 'dev';
  18063. }
  18064. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  18065. {
  18066. if (!$url) {
  18067. return array();
  18068. }
  18069. $urls = array($url);
  18070. if ($mirrors) {
  18071. foreach ($mirrors as $mirror) {
  18072. if ($urlType === 'dist') {
  18073. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  18074. } elseif ($urlType === 'source' && $type === 'git') {
  18075. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  18076. } elseif ($urlType === 'source' && $type === 'hg') {
  18077. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  18078. }
  18079. if (!in_array($mirrorUrl, $urls)) {
  18080. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  18081. $func($urls, $mirrorUrl);
  18082. }
  18083. }
  18084. }
  18085. return $urls;
  18086. }
  18087. }
  18088. <?php
  18089. namespace Composer\Package;
  18090. use Composer\Repository\RepositoryInterface;
  18091. interface PackageInterface
  18092. {
  18093. public function getName();
  18094. public function getPrettyName();
  18095. public function getNames();
  18096. public function setId($id);
  18097. public function getId();
  18098. public function isDev();
  18099. public function getType();
  18100. public function getTargetDir();
  18101. public function getExtra();
  18102. public function setInstallationSource($type);
  18103. public function getInstallationSource();
  18104. public function getSourceType();
  18105. public function getSourceUrl();
  18106. public function getSourceUrls();
  18107. public function getSourceReference();
  18108. public function getSourceMirrors();
  18109. public function getDistType();
  18110. public function getDistUrl();
  18111. public function getDistUrls();
  18112. public function getDistReference();
  18113. public function getDistSha1Checksum();
  18114. public function getDistMirrors();
  18115. public function getVersion();
  18116. public function getPrettyVersion();
  18117. public function getFullPrettyVersion($truncate = true);
  18118. public function getReleaseDate();
  18119. public function getStability();
  18120. public function getRequires();
  18121. public function getConflicts();
  18122. public function getProvides();
  18123. public function getReplaces();
  18124. public function getDevRequires();
  18125. public function getSuggests();
  18126. public function getAutoload();
  18127. public function getDevAutoload();
  18128. public function getIncludePaths();
  18129. public function setRepository(RepositoryInterface $repository);
  18130. public function getRepository();
  18131. public function getBinaries();
  18132. public function getUniqueName();
  18133. public function getNotificationUrl();
  18134. public function __toString();
  18135. public function getPrettyString();
  18136. public function getArchiveExcludes();
  18137. public function getTransportOptions();
  18138. }
  18139. <?php
  18140. namespace Composer\Package;
  18141. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  18142. {
  18143. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  18144. {
  18145. parent::__construct($aliasOf, $version, $prettyVersion);
  18146. }
  18147. public function getAliases()
  18148. {
  18149. return $this->aliasOf->getAliases();
  18150. }
  18151. public function getMinimumStability()
  18152. {
  18153. return $this->aliasOf->getMinimumStability();
  18154. }
  18155. public function getStabilityFlags()
  18156. {
  18157. return $this->aliasOf->getStabilityFlags();
  18158. }
  18159. public function getReferences()
  18160. {
  18161. return $this->aliasOf->getReferences();
  18162. }
  18163. public function getPreferStable()
  18164. {
  18165. return $this->aliasOf->getPreferStable();
  18166. }
  18167. public function getConfig()
  18168. {
  18169. return $this->aliasOf->getConfig();
  18170. }
  18171. public function setRequires(array $require)
  18172. {
  18173. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  18174. $this->aliasOf->setRequires($require);
  18175. }
  18176. public function setDevRequires(array $devRequire)
  18177. {
  18178. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  18179. $this->aliasOf->setDevRequires($devRequire);
  18180. }
  18181. public function setConflicts(array $conflicts)
  18182. {
  18183. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  18184. $this->aliasOf->setConflicts($conflicts);
  18185. }
  18186. public function setProvides(array $provides)
  18187. {
  18188. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  18189. $this->aliasOf->setProvides($provides);
  18190. }
  18191. public function setReplaces(array $replaces)
  18192. {
  18193. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  18194. $this->aliasOf->setReplaces($replaces);
  18195. }
  18196. public function setRepositories($repositories)
  18197. {
  18198. $this->aliasOf->setRepositories($repositories);
  18199. }
  18200. public function setAutoload(array $autoload)
  18201. {
  18202. $this->aliasOf->setAutoload($autoload);
  18203. }
  18204. public function setDevAutoload(array $devAutoload)
  18205. {
  18206. $this->aliasOf->setDevAutoload($devAutoload);
  18207. }
  18208. public function setStabilityFlags(array $stabilityFlags)
  18209. {
  18210. $this->aliasOf->setStabilityFlags($stabilityFlags);
  18211. }
  18212. public function setSuggests(array $suggests)
  18213. {
  18214. $this->aliasOf->setSuggests($suggests);
  18215. }
  18216. public function setExtra(array $extra)
  18217. {
  18218. $this->aliasOf->setExtra($extra);
  18219. }
  18220. public function __clone()
  18221. {
  18222. parent::__clone();
  18223. $this->aliasOf = clone $this->aliasOf;
  18224. }
  18225. }
  18226. <?php
  18227. namespace Composer\Package;
  18228. class RootPackage extends CompletePackage implements RootPackageInterface
  18229. {
  18230. protected $minimumStability = 'stable';
  18231. protected $preferStable = false;
  18232. protected $stabilityFlags = array();
  18233. protected $config = array();
  18234. protected $references = array();
  18235. protected $aliases = array();
  18236. public function setMinimumStability($minimumStability)
  18237. {
  18238. $this->minimumStability = $minimumStability;
  18239. }
  18240. public function getMinimumStability()
  18241. {
  18242. return $this->minimumStability;
  18243. }
  18244. public function setStabilityFlags(array $stabilityFlags)
  18245. {
  18246. $this->stabilityFlags = $stabilityFlags;
  18247. }
  18248. public function getStabilityFlags()
  18249. {
  18250. return $this->stabilityFlags;
  18251. }
  18252. public function setPreferStable($preferStable)
  18253. {
  18254. $this->preferStable = $preferStable;
  18255. }
  18256. public function getPreferStable()
  18257. {
  18258. return $this->preferStable;
  18259. }
  18260. public function setConfig(array $config)
  18261. {
  18262. $this->config = $config;
  18263. }
  18264. public function getConfig()
  18265. {
  18266. return $this->config;
  18267. }
  18268. public function setReferences(array $references)
  18269. {
  18270. $this->references = $references;
  18271. }
  18272. public function getReferences()
  18273. {
  18274. return $this->references;
  18275. }
  18276. public function setAliases(array $aliases)
  18277. {
  18278. $this->aliases = $aliases;
  18279. }
  18280. public function getAliases()
  18281. {
  18282. return $this->aliases;
  18283. }
  18284. }
  18285. <?php
  18286. namespace Composer\Package;
  18287. interface RootPackageInterface extends CompletePackageInterface
  18288. {
  18289. public function getAliases();
  18290. public function getMinimumStability();
  18291. public function getStabilityFlags();
  18292. public function getReferences();
  18293. public function getPreferStable();
  18294. public function getConfig();
  18295. public function setRequires(array $requires);
  18296. public function setDevRequires(array $devRequires);
  18297. public function setConflicts(array $conflicts);
  18298. public function setProvides(array $provides);
  18299. public function setReplaces(array $replaces);
  18300. public function setRepositories($repositories);
  18301. public function setAutoload(array $autoload);
  18302. public function setDevAutoload(array $devAutoload);
  18303. public function setStabilityFlags(array $stabilityFlags);
  18304. public function setSuggests(array $suggests);
  18305. public function setExtra(array $extra);
  18306. }
  18307. <?php
  18308. namespace Composer\Package\Version;
  18309. use Composer\Config;
  18310. use Composer\Repository\Vcs\HgDriver;
  18311. use Composer\IO\NullIO;
  18312. use Composer\Semver\VersionParser as SemverVersionParser;
  18313. use Composer\Util\Git as GitUtil;
  18314. use Composer\Util\ProcessExecutor;
  18315. use Composer\Util\Svn as SvnUtil;
  18316. class VersionGuesser
  18317. {
  18318. private $config;
  18319. private $process;
  18320. private $versionParser;
  18321. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  18322. {
  18323. $this->config = $config;
  18324. $this->process = $process;
  18325. $this->versionParser = $versionParser;
  18326. }
  18327. public function guessVersion(array $packageConfig, $path)
  18328. {
  18329. if (function_exists('proc_open')) {
  18330. $versionData = $this->guessGitVersion($packageConfig, $path);
  18331. if (null !== $versionData && null !== $versionData['version']) {
  18332. return $this->postprocess($versionData);
  18333. }
  18334. $versionData = $this->guessHgVersion($packageConfig, $path);
  18335. if (null !== $versionData && null !== $versionData['version']) {
  18336. return $this->postprocess($versionData);
  18337. }
  18338. $versionData = $this->guessFossilVersion($packageConfig, $path);
  18339. if (null !== $versionData && null !== $versionData['version']) {
  18340. return $this->postprocess($versionData);
  18341. }
  18342. $versionData = $this->guessSvnVersion($packageConfig, $path);
  18343. if (null !== $versionData && null !== $versionData['version']) {
  18344. return $this->postprocess($versionData);
  18345. }
  18346. }
  18347. }
  18348. private function postprocess(array $versionData)
  18349. {
  18350. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  18351. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  18352. }
  18353. return $versionData;
  18354. }
  18355. private function guessGitVersion(array $packageConfig, $path)
  18356. {
  18357. GitUtil::cleanEnv();
  18358. $commit = null;
  18359. $version = null;
  18360. $prettyVersion = null;
  18361. $isDetached = false;
  18362. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  18363. $branches = array();
  18364. $isFeatureBranch = false;
  18365. foreach ($this->process->splitLines($output) as $branch) {
  18366. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  18367. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  18368. $version = 'dev-' . $match[2];
  18369. $prettyVersion = $version;
  18370. $isFeatureBranch = true;
  18371. $isDetached = true;
  18372. } else {
  18373. $version = $this->versionParser->normalizeBranch($match[1]);
  18374. $prettyVersion = 'dev-' . $match[1];
  18375. $isFeatureBranch = 0 === strpos($version, 'dev-');
  18376. }
  18377. if ($match[2]) {
  18378. $commit = $match[2];
  18379. }
  18380. }
  18381. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  18382. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  18383. $branches[] = $match[1];
  18384. }
  18385. }
  18386. }
  18387. if ($isFeatureBranch) {
  18388. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  18389. $version = $result['version'];
  18390. $prettyVersion = $result['pretty_version'];
  18391. }
  18392. }
  18393. if (!$version || $isDetached) {
  18394. $result = $this->versionFromGitTags($path);
  18395. if ($result) {
  18396. $version = $result['version'];
  18397. $prettyVersion = $result['pretty_version'];
  18398. }
  18399. }
  18400. if (!$commit) {
  18401. $command = 'git log --pretty="%H" -n1 HEAD';
  18402. if (0 === $this->process->execute($command, $output, $path)) {
  18403. $commit = trim($output) ?: null;
  18404. }
  18405. }
  18406. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  18407. }
  18408. private function versionFromGitTags($path)
  18409. {
  18410. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  18411. try {
  18412. $version = $this->versionParser->normalize(trim($output));
  18413. return array('version' => $version, 'pretty_version' => trim($output));
  18414. } catch (\Exception $e) {
  18415. }
  18416. }
  18417. return null;
  18418. }
  18419. private function guessHgVersion(array $packageConfig, $path)
  18420. {
  18421. if (0 === $this->process->execute('hg branch', $output, $path)) {
  18422. $branch = trim($output);
  18423. $version = $this->versionParser->normalizeBranch($branch);
  18424. $isFeatureBranch = 0 === strpos($version, 'dev-');
  18425. if ('9999999-dev' === $version) {
  18426. $version = 'dev-' . $branch;
  18427. }
  18428. if (!$isFeatureBranch) {
  18429. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  18430. }
  18431. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  18432. $branches = array_keys($driver->getBranches());
  18433. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  18434. $result['commit'] = '';
  18435. return $result;
  18436. }
  18437. }
  18438. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  18439. {
  18440. $prettyVersion = $version;
  18441. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  18442. || strpos(json_encode($packageConfig), '"self.version"')
  18443. ) {
  18444. $branch = preg_replace('{^dev-}', '', $version);
  18445. $length = PHP_INT_MAX;
  18446. $nonFeatureBranches = '';
  18447. if (!empty($packageConfig['non-feature-branches'])) {
  18448. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  18449. }
  18450. foreach ($branches as $candidate) {
  18451. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  18452. break;
  18453. }
  18454. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  18455. continue;
  18456. }
  18457. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  18458. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  18459. continue;
  18460. }
  18461. if (strlen($output) < $length) {
  18462. $length = strlen($output);
  18463. $version = $this->versionParser->normalizeBranch($candidate);
  18464. $prettyVersion = 'dev-' . $match[1];
  18465. if ('9999999-dev' === $version) {
  18466. $version = $prettyVersion;
  18467. }
  18468. }
  18469. }
  18470. }
  18471. return array('version' => $version, 'pretty_version' => $prettyVersion);
  18472. }
  18473. private function guessFossilVersion(array $packageConfig, $path)
  18474. {
  18475. $version = null;
  18476. $prettyVersion = null;
  18477. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  18478. $branch = trim($output);
  18479. $version = $this->versionParser->normalizeBranch($branch);
  18480. $prettyVersion = 'dev-' . $branch;
  18481. if ('9999999-dev' === $version) {
  18482. $version = $prettyVersion;
  18483. }
  18484. }
  18485. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  18486. try {
  18487. $version = $this->versionParser->normalize(trim($output));
  18488. $prettyVersion = trim($output);
  18489. } catch (\Exception $e) {
  18490. }
  18491. }
  18492. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18493. }
  18494. private function guessSvnVersion(array $packageConfig, $path)
  18495. {
  18496. SvnUtil::cleanEnv();
  18497. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  18498. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  18499. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  18500. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  18501. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  18502. if (preg_match($urlPattern, $output, $matches)) {
  18503. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  18504. $version = $this->versionParser->normalizeBranch($matches[3]);
  18505. $prettyVersion = 'dev-' . $matches[3];
  18506. if ('9999999-dev' === $version) {
  18507. $version = $prettyVersion;
  18508. }
  18509. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18510. }
  18511. $prettyVersion = trim($matches[1]);
  18512. $version = $this->versionParser->normalize($prettyVersion);
  18513. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18514. }
  18515. }
  18516. }
  18517. }
  18518. <?php
  18519. namespace Composer\Package\Version;
  18520. use Composer\Repository\PlatformRepository;
  18521. use Composer\Semver\VersionParser as SemverVersionParser;
  18522. class VersionParser extends SemverVersionParser
  18523. {
  18524. private static $constraints = array();
  18525. public function parseConstraints($constraints)
  18526. {
  18527. if (!isset(self::$constraints[$constraints])) {
  18528. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  18529. }
  18530. return self::$constraints[$constraints];
  18531. }
  18532. public function parseNameVersionPairs(array $pairs)
  18533. {
  18534. $pairs = array_values($pairs);
  18535. $result = array();
  18536. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  18537. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  18538. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  18539. $pair .= ' '.$pairs[$i + 1];
  18540. $i++;
  18541. }
  18542. if (strpos($pair, ' ')) {
  18543. list($name, $version) = explode(' ', $pair, 2);
  18544. $result[] = array('name' => $name, 'version' => $version);
  18545. } else {
  18546. $result[] = array('name' => $pair);
  18547. }
  18548. }
  18549. return $result;
  18550. }
  18551. }
  18552. <?php
  18553. namespace Composer\Package\Version;
  18554. use Composer\DependencyResolver\Pool;
  18555. use Composer\Package\BasePackage;
  18556. use Composer\Package\PackageInterface;
  18557. use Composer\Package\Loader\ArrayLoader;
  18558. use Composer\Package\Dumper\ArrayDumper;
  18559. use Composer\Semver\Constraint\Constraint;
  18560. class VersionSelector
  18561. {
  18562. private $pool;
  18563. private $parser;
  18564. public function __construct(Pool $pool)
  18565. {
  18566. $this->pool = $pool;
  18567. }
  18568. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  18569. {
  18570. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  18571. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  18572. if ($targetPhpVersion) {
  18573. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  18574. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  18575. $reqs = $pkg->getRequires();
  18576. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  18577. });
  18578. }
  18579. if (!$candidates) {
  18580. return false;
  18581. }
  18582. $package = reset($candidates);
  18583. $minPriority = BasePackage::$stabilities[$preferredStability];
  18584. foreach ($candidates as $candidate) {
  18585. $candidatePriority = $candidate->getStabilityPriority();
  18586. $currentPriority = $package->getStabilityPriority();
  18587. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  18588. continue;
  18589. }
  18590. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  18591. $package = $candidate;
  18592. continue;
  18593. }
  18594. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  18595. $package = $candidate;
  18596. continue;
  18597. }
  18598. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  18599. $package = $candidate;
  18600. }
  18601. }
  18602. return $package;
  18603. }
  18604. public function findRecommendedRequireVersion(PackageInterface $package)
  18605. {
  18606. $version = $package->getVersion();
  18607. if (!$package->isDev()) {
  18608. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  18609. }
  18610. $loader = new ArrayLoader($this->getParser());
  18611. $dumper = new ArrayDumper();
  18612. $extra = $loader->getBranchAlias($dumper->dump($package));
  18613. if ($extra) {
  18614. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  18615. if ($count) {
  18616. $extra = str_replace('.9999999', '.0', $extra);
  18617. return $this->transformVersion($extra, $extra, 'dev');
  18618. }
  18619. }
  18620. return $package->getPrettyVersion();
  18621. }
  18622. private function transformVersion($version, $prettyVersion, $stability)
  18623. {
  18624. $semanticVersionParts = explode('.', $version);
  18625. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  18626. if ($semanticVersionParts[0] === '0') {
  18627. unset($semanticVersionParts[3]);
  18628. } else {
  18629. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  18630. }
  18631. $version = implode('.', $semanticVersionParts);
  18632. } else {
  18633. return $prettyVersion;
  18634. }
  18635. if ($stability != 'stable') {
  18636. $version .= '@'.$stability;
  18637. }
  18638. return '^' . $version;
  18639. }
  18640. private function getParser()
  18641. {
  18642. if ($this->parser === null) {
  18643. $this->parser = new VersionParser();
  18644. }
  18645. return $this->parser;
  18646. }
  18647. }
  18648. <?php
  18649. namespace Composer\Plugin\Capability;
  18650. interface Capability
  18651. {
  18652. }
  18653. <?php
  18654. namespace Composer\Plugin\Capability;
  18655. interface CommandProvider extends Capability
  18656. {
  18657. public function getCommands();
  18658. }
  18659. <?php
  18660. namespace Composer\Plugin;
  18661. interface Capable
  18662. {
  18663. public function getCapabilities();
  18664. }
  18665. <?php
  18666. namespace Composer\Plugin;
  18667. use Composer\EventDispatcher\Event;
  18668. use Symfony\Component\Console\Input\InputInterface;
  18669. use Symfony\Component\Console\Output\OutputInterface;
  18670. class CommandEvent extends Event
  18671. {
  18672. private $commandName;
  18673. private $input;
  18674. private $output;
  18675. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  18676. {
  18677. parent::__construct($name, $args, $flags);
  18678. $this->commandName = $commandName;
  18679. $this->input = $input;
  18680. $this->output = $output;
  18681. }
  18682. public function getInput()
  18683. {
  18684. return $this->input;
  18685. }
  18686. public function getOutput()
  18687. {
  18688. return $this->output;
  18689. }
  18690. public function getCommandName()
  18691. {
  18692. return $this->commandName;
  18693. }
  18694. }
  18695. <?php
  18696. namespace Composer\Plugin;
  18697. class PluginEvents
  18698. {
  18699. const INIT = 'init';
  18700. const COMMAND = 'command';
  18701. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  18702. const PRE_COMMAND_RUN = 'pre-command-run';
  18703. }
  18704. <?php
  18705. namespace Composer\Plugin;
  18706. use Composer\Composer;
  18707. use Composer\IO\IOInterface;
  18708. interface PluginInterface
  18709. {
  18710. const PLUGIN_API_VERSION = '1.1.0';
  18711. public function activate(Composer $composer, IOInterface $io);
  18712. }
  18713. <?php
  18714. namespace Composer\Plugin;
  18715. use Composer\Composer;
  18716. use Composer\EventDispatcher\EventSubscriberInterface;
  18717. use Composer\IO\IOInterface;
  18718. use Composer\Package\Package;
  18719. use Composer\Package\Version\VersionParser;
  18720. use Composer\Repository\RepositoryInterface;
  18721. use Composer\Package\AliasPackage;
  18722. use Composer\Package\PackageInterface;
  18723. use Composer\Package\Link;
  18724. use Composer\Semver\Constraint\Constraint;
  18725. use Composer\DependencyResolver\Pool;
  18726. use Composer\Plugin\Capability\Capability;
  18727. class PluginManager
  18728. {
  18729. protected $composer;
  18730. protected $io;
  18731. protected $globalComposer;
  18732. protected $versionParser;
  18733. protected $disablePlugins = false;
  18734. protected $plugins = array();
  18735. protected $registeredPlugins = array();
  18736. private static $classCounter = 0;
  18737. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  18738. {
  18739. $this->io = $io;
  18740. $this->composer = $composer;
  18741. $this->globalComposer = $globalComposer;
  18742. $this->versionParser = new VersionParser();
  18743. $this->disablePlugins = $disablePlugins;
  18744. }
  18745. public function loadInstalledPlugins()
  18746. {
  18747. if ($this->disablePlugins) {
  18748. return;
  18749. }
  18750. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  18751. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  18752. if ($repo) {
  18753. $this->loadRepository($repo);
  18754. }
  18755. if ($globalRepo) {
  18756. $this->loadRepository($globalRepo);
  18757. }
  18758. }
  18759. public function getPlugins()
  18760. {
  18761. return $this->plugins;
  18762. }
  18763. public function getGlobalComposer()
  18764. {
  18765. return $this->globalComposer;
  18766. }
  18767. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  18768. {
  18769. if ($this->disablePlugins) {
  18770. return;
  18771. }
  18772. if ($package->getType() === 'composer-plugin') {
  18773. $requiresComposer = null;
  18774. foreach ($package->getRequires() as $link) {
  18775. if ('composer-plugin-api' === $link->getTarget()) {
  18776. $requiresComposer = $link->getConstraint();
  18777. break;
  18778. }
  18779. }
  18780. if (!$requiresComposer) {
  18781. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  18782. }
  18783. $currentPluginApiVersion = $this->getPluginApiVersion();
  18784. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  18785. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  18786. $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>');
  18787. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  18788. $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>');
  18789. return;
  18790. }
  18791. }
  18792. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  18793. if (in_array($package->getName(), $this->registeredPlugins)) {
  18794. return;
  18795. }
  18796. $extra = $package->getExtra();
  18797. if (empty($extra['class'])) {
  18798. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  18799. }
  18800. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  18801. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  18802. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  18803. $pool = new Pool('dev');
  18804. $pool->addRepository($localRepo);
  18805. if ($globalRepo) {
  18806. $pool->addRepository($globalRepo);
  18807. }
  18808. $autoloadPackages = array($package->getName() => $package);
  18809. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  18810. $generator = $this->composer->getAutoloadGenerator();
  18811. $autoloads = array();
  18812. foreach ($autoloadPackages as $autoloadPackage) {
  18813. $downloadPath = $this->getInstallPath($autoloadPackage, ($globalRepo && $globalRepo->hasPackage($autoloadPackage)));
  18814. $autoloads[] = array($autoloadPackage, $downloadPath);
  18815. }
  18816. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  18817. $classLoader = $generator->createLoader($map);
  18818. $classLoader->register();
  18819. foreach ($classes as $class) {
  18820. if (class_exists($class, false)) {
  18821. $class = trim($class, '\\');
  18822. $path = $classLoader->findFile($class);
  18823. $code = file_get_contents($path);
  18824. $separatorPos = strrpos($class, '\\');
  18825. $className = $class;
  18826. if ($separatorPos) {
  18827. $className = substr($class, $separatorPos + 1);
  18828. }
  18829. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  18830. $code = str_replace('__FILE__', var_export($path, true), $code);
  18831. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  18832. $code = str_replace('__CLASS__', var_export($class, true), $code);
  18833. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  18834. eval($code);
  18835. $class .= '_composer_tmp'.self::$classCounter;
  18836. self::$classCounter++;
  18837. }
  18838. if ($oldInstallerPlugin) {
  18839. $installer = new $class($this->io, $this->composer);
  18840. $this->composer->getInstallationManager()->addInstaller($installer);
  18841. } elseif (class_exists($class)) {
  18842. $plugin = new $class();
  18843. $this->addPlugin($plugin);
  18844. $this->registeredPlugins[] = $package->getName();
  18845. } elseif ($failOnMissingClasses) {
  18846. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  18847. }
  18848. }
  18849. }
  18850. protected function getPluginApiVersion()
  18851. {
  18852. return PluginInterface::PLUGIN_API_VERSION;
  18853. }
  18854. public function addPlugin(PluginInterface $plugin)
  18855. {
  18856. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  18857. $this->plugins[] = $plugin;
  18858. $plugin->activate($this->composer, $this->io);
  18859. if ($plugin instanceof EventSubscriberInterface) {
  18860. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  18861. }
  18862. }
  18863. private function loadRepository(RepositoryInterface $repo)
  18864. {
  18865. foreach ($repo->getPackages() as $package) {
  18866. if ($package instanceof AliasPackage) {
  18867. continue;
  18868. }
  18869. if ('composer-plugin' === $package->getType()) {
  18870. $this->registerPackage($package);
  18871. } elseif ('composer-installer' === $package->getType()) {
  18872. $this->registerPackage($package);
  18873. }
  18874. }
  18875. }
  18876. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  18877. {
  18878. $requires = array_merge(
  18879. $package->getRequires(),
  18880. $package->getDevRequires()
  18881. );
  18882. foreach ($requires as $requireLink) {
  18883. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  18884. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  18885. $collected[$requiredPackage->getName()] = $requiredPackage;
  18886. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  18887. }
  18888. }
  18889. return $collected;
  18890. }
  18891. private function lookupInstalledPackage(Pool $pool, Link $link)
  18892. {
  18893. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  18894. return (!empty($packages)) ? $packages[0] : null;
  18895. }
  18896. private function getInstallPath(PackageInterface $package, $global = false)
  18897. {
  18898. if (!$global) {
  18899. return $this->composer->getInstallationManager()->getInstallPath($package);
  18900. }
  18901. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  18902. }
  18903. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  18904. {
  18905. if (!($plugin instanceof Capable)) {
  18906. return null;
  18907. }
  18908. $capabilities = (array) $plugin->getCapabilities();
  18909. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  18910. return trim($capabilities[$capability]);
  18911. }
  18912. if (
  18913. array_key_exists($capability, $capabilities)
  18914. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  18915. ) {
  18916. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  18917. }
  18918. }
  18919. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  18920. {
  18921. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  18922. if (!class_exists($capabilityClass)) {
  18923. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  18924. }
  18925. $ctorArgs['plugin'] = $plugin;
  18926. $capabilityObj = new $capabilityClass($ctorArgs);
  18927. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  18928. throw new \RuntimeException(
  18929. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  18930. );
  18931. }
  18932. return $capabilityObj;
  18933. }
  18934. }
  18935. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  18936. {
  18937. $capabilities = array();
  18938. foreach ($this->getPlugins() as $plugin) {
  18939. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  18940. $capabilities[] = $capability;
  18941. }
  18942. }
  18943. return $capabilities;
  18944. }
  18945. }
  18946. <?php
  18947. namespace Composer\Plugin;
  18948. use Composer\EventDispatcher\Event;
  18949. use Symfony\Component\Console\Input\InputInterface;
  18950. class PreCommandRunEvent extends Event
  18951. {
  18952. private $input;
  18953. private $command;
  18954. public function __construct($name, InputInterface $input, $command)
  18955. {
  18956. parent::__construct($name);
  18957. $this->input = $input;
  18958. $this->command = $command;
  18959. }
  18960. public function getInput()
  18961. {
  18962. return $this->input;
  18963. }
  18964. public function getCommand()
  18965. {
  18966. return $this->command;
  18967. }
  18968. }
  18969. <?php
  18970. namespace Composer\Plugin;
  18971. use Composer\EventDispatcher\Event;
  18972. use Composer\Util\RemoteFilesystem;
  18973. class PreFileDownloadEvent extends Event
  18974. {
  18975. private $rfs;
  18976. private $processedUrl;
  18977. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  18978. {
  18979. parent::__construct($name);
  18980. $this->rfs = $rfs;
  18981. $this->processedUrl = $processedUrl;
  18982. }
  18983. public function getRemoteFilesystem()
  18984. {
  18985. return $this->rfs;
  18986. }
  18987. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  18988. {
  18989. $this->rfs = $rfs;
  18990. }
  18991. public function getProcessedUrl()
  18992. {
  18993. return $this->processedUrl;
  18994. }
  18995. }
  18996. <?php
  18997. namespace Composer\Question;
  18998. use Symfony\Component\Console\Exception\InvalidArgumentException;
  18999. use Symfony\Component\Console\Question\Question;
  19000. class StrictConfirmationQuestion extends Question
  19001. {
  19002. private $trueAnswerRegex;
  19003. private $falseAnswerRegex;
  19004. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  19005. {
  19006. parent::__construct($question, (bool) $default);
  19007. $this->trueAnswerRegex = $trueAnswerRegex;
  19008. $this->falseAnswerRegex = $falseAnswerRegex;
  19009. $this->setNormalizer($this->getDefaultNormalizer());
  19010. $this->setValidator($this->getDefaultValidator());
  19011. }
  19012. private function getDefaultNormalizer()
  19013. {
  19014. $default = $this->getDefault();
  19015. $trueRegex = $this->trueAnswerRegex;
  19016. $falseRegex = $this->falseAnswerRegex;
  19017. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  19018. if (is_bool($answer)) {
  19019. return $answer;
  19020. }
  19021. if (empty($answer) && !empty($default)) {
  19022. return $default;
  19023. }
  19024. if (preg_match($trueRegex, $answer)) {
  19025. return true;
  19026. }
  19027. if (preg_match($falseRegex, $answer)) {
  19028. return false;
  19029. }
  19030. return null;
  19031. };
  19032. }
  19033. private function getDefaultValidator()
  19034. {
  19035. return function ($answer) {
  19036. if (!is_bool($answer)) {
  19037. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  19038. }
  19039. return $answer;
  19040. };
  19041. }
  19042. }
  19043. <?php
  19044. namespace Composer\Repository;
  19045. use Composer\Package\AliasPackage;
  19046. use Composer\Package\PackageInterface;
  19047. use Composer\Package\CompletePackageInterface;
  19048. use Composer\Package\Version\VersionParser;
  19049. use Composer\Semver\Constraint\ConstraintInterface;
  19050. use Composer\Semver\Constraint\Constraint;
  19051. class ArrayRepository extends BaseRepository
  19052. {
  19053. protected $packages;
  19054. public function __construct(array $packages = array())
  19055. {
  19056. foreach ($packages as $package) {
  19057. $this->addPackage($package);
  19058. }
  19059. }
  19060. public function findPackage($name, $constraint)
  19061. {
  19062. $name = strtolower($name);
  19063. if (!$constraint instanceof ConstraintInterface) {
  19064. $versionParser = new VersionParser();
  19065. $constraint = $versionParser->parseConstraints($constraint);
  19066. }
  19067. foreach ($this->getPackages() as $package) {
  19068. if ($name === $package->getName()) {
  19069. $pkgConstraint = new Constraint('==', $package->getVersion());
  19070. if ($constraint->matches($pkgConstraint)) {
  19071. return $package;
  19072. }
  19073. }
  19074. }
  19075. return null;
  19076. }
  19077. public function findPackages($name, $constraint = null)
  19078. {
  19079. $name = strtolower($name);
  19080. $packages = array();
  19081. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19082. $versionParser = new VersionParser();
  19083. $constraint = $versionParser->parseConstraints($constraint);
  19084. }
  19085. foreach ($this->getPackages() as $package) {
  19086. if ($name === $package->getName()) {
  19087. $pkgConstraint = new Constraint('==', $package->getVersion());
  19088. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19089. $packages[] = $package;
  19090. }
  19091. }
  19092. }
  19093. return $packages;
  19094. }
  19095. public function search($query, $mode = 0, $type = null)
  19096. {
  19097. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19098. $matches = array();
  19099. foreach ($this->getPackages() as $package) {
  19100. $name = $package->getName();
  19101. if (isset($matches[$name])) {
  19102. continue;
  19103. }
  19104. if (preg_match($regex, $name)
  19105. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  19106. ) {
  19107. if (null !== $type && $package->getType() !== $type) {
  19108. continue;
  19109. }
  19110. $matches[$name] = array(
  19111. 'name' => $package->getPrettyName(),
  19112. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  19113. );
  19114. }
  19115. }
  19116. return array_values($matches);
  19117. }
  19118. public function hasPackage(PackageInterface $package)
  19119. {
  19120. $packageId = $package->getUniqueName();
  19121. foreach ($this->getPackages() as $repoPackage) {
  19122. if ($packageId === $repoPackage->getUniqueName()) {
  19123. return true;
  19124. }
  19125. }
  19126. return false;
  19127. }
  19128. public function addPackage(PackageInterface $package)
  19129. {
  19130. if (null === $this->packages) {
  19131. $this->initialize();
  19132. }
  19133. $package->setRepository($this);
  19134. $this->packages[] = $package;
  19135. if ($package instanceof AliasPackage) {
  19136. $aliasedPackage = $package->getAliasOf();
  19137. if (null === $aliasedPackage->getRepository()) {
  19138. $this->addPackage($aliasedPackage);
  19139. }
  19140. }
  19141. }
  19142. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  19143. {
  19144. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  19145. }
  19146. public function removePackage(PackageInterface $package)
  19147. {
  19148. $packageId = $package->getUniqueName();
  19149. foreach ($this->getPackages() as $key => $repoPackage) {
  19150. if ($packageId === $repoPackage->getUniqueName()) {
  19151. array_splice($this->packages, $key, 1);
  19152. return;
  19153. }
  19154. }
  19155. }
  19156. public function getPackages()
  19157. {
  19158. if (null === $this->packages) {
  19159. $this->initialize();
  19160. }
  19161. return $this->packages;
  19162. }
  19163. public function count()
  19164. {
  19165. return count($this->packages);
  19166. }
  19167. protected function initialize()
  19168. {
  19169. $this->packages = array();
  19170. }
  19171. }
  19172. <?php
  19173. namespace Composer\Repository;
  19174. use Composer\IO\IOInterface;
  19175. use Composer\Json\JsonFile;
  19176. use Composer\Package\Loader\ArrayLoader;
  19177. use Composer\Package\Loader\LoaderInterface;
  19178. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19179. {
  19180. protected $loader;
  19181. protected $lookup;
  19182. protected $repoConfig;
  19183. private $io;
  19184. public function __construct(array $repoConfig, IOInterface $io)
  19185. {
  19186. parent::__construct();
  19187. if (!extension_loaded('zip')) {
  19188. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  19189. }
  19190. $this->loader = new ArrayLoader();
  19191. $this->lookup = $repoConfig['url'];
  19192. $this->io = $io;
  19193. $this->repoConfig = $repoConfig;
  19194. }
  19195. public function getRepoConfig()
  19196. {
  19197. return $this->repoConfig;
  19198. }
  19199. protected function initialize()
  19200. {
  19201. parent::initialize();
  19202. $this->scanDirectory($this->lookup);
  19203. }
  19204. private function scanDirectory($path)
  19205. {
  19206. $io = $this->io;
  19207. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  19208. $iterator = new \RecursiveIteratorIterator($directory);
  19209. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  19210. foreach ($regex as $file) {
  19211. if (!$file->isFile()) {
  19212. continue;
  19213. }
  19214. $package = $this->getComposerInformation($file);
  19215. if (!$package) {
  19216. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  19217. continue;
  19218. }
  19219. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  19220. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  19221. $this->addPackage($package);
  19222. }
  19223. }
  19224. private function locateFile(\ZipArchive $zip, $filename)
  19225. {
  19226. $indexOfShortestMatch = false;
  19227. $lengthOfShortestMatch = -1;
  19228. for ($i = 0; $i < $zip->numFiles; $i++) {
  19229. $stat = $zip->statIndex($i);
  19230. if (strcmp(basename($stat['name']), $filename) === 0) {
  19231. $directoryName = dirname($stat['name']);
  19232. if ($directoryName == '.') {
  19233. return $i;
  19234. }
  19235. if (strpos($directoryName, '\\') !== false ||
  19236. strpos($directoryName, '/') !== false) {
  19237. continue;
  19238. }
  19239. $length = strlen($stat['name']);
  19240. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  19241. $contents = $zip->getFromIndex($i);
  19242. if ($contents !== false) {
  19243. $indexOfShortestMatch = $i;
  19244. $lengthOfShortestMatch = $length;
  19245. }
  19246. }
  19247. }
  19248. }
  19249. return $indexOfShortestMatch;
  19250. }
  19251. private function getComposerInformation(\SplFileInfo $file)
  19252. {
  19253. $zip = new \ZipArchive();
  19254. $zip->open($file->getPathname());
  19255. if (0 == $zip->numFiles) {
  19256. return false;
  19257. }
  19258. $foundFileIndex = $this->locateFile($zip, 'composer.json');
  19259. if (false === $foundFileIndex) {
  19260. return false;
  19261. }
  19262. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  19263. $composerFile = "zip://{$file->getPathname()}#$configurationFileName";
  19264. $json = file_get_contents($composerFile);
  19265. $package = JsonFile::parseJson($json, $composerFile);
  19266. $package['dist'] = array(
  19267. 'type' => 'zip',
  19268. 'url' => strtr($file->getPathname(), '\\', '/'),
  19269. 'shasum' => sha1_file($file->getRealPath()),
  19270. );
  19271. try {
  19272. $package = $this->loader->load($package);
  19273. } catch (\UnexpectedValueException $e) {
  19274. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  19275. }
  19276. return $package;
  19277. }
  19278. }
  19279. <?php
  19280. namespace Composer\Repository;
  19281. use Composer\Package\RootPackageInterface;
  19282. use Composer\Semver\Constraint\ConstraintInterface;
  19283. use Composer\Semver\Constraint\Constraint;
  19284. use Composer\Package\Link;
  19285. abstract class BaseRepository implements RepositoryInterface
  19286. {
  19287. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  19288. {
  19289. $needles = (array) $needle;
  19290. $results = array();
  19291. if (null === $packagesFound) {
  19292. $packagesFound = $needles;
  19293. }
  19294. $rootPackage = null;
  19295. foreach ($this->getPackages() as $package) {
  19296. if ($package instanceof RootPackageInterface) {
  19297. $rootPackage = $package;
  19298. break;
  19299. }
  19300. }
  19301. foreach ($this->getPackages() as $package) {
  19302. $links = $package->getRequires();
  19303. $packagesInTree = $packagesFound;
  19304. if (!$invert) {
  19305. $links += $package->getReplaces();
  19306. }
  19307. if ($package instanceof RootPackageInterface) {
  19308. $links += $package->getDevRequires();
  19309. }
  19310. foreach ($links as $link) {
  19311. foreach ($needles as $needle) {
  19312. if ($link->getTarget() === $needle) {
  19313. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  19314. if (in_array($link->getSource(), $packagesInTree)) {
  19315. $results[$link->getSource()] = array($package, $link, false);
  19316. continue;
  19317. }
  19318. $packagesInTree[] = $link->getSource();
  19319. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  19320. $results[$link->getSource()] = array($package, $link, $dependents);
  19321. }
  19322. }
  19323. }
  19324. }
  19325. if ($invert && in_array($package->getName(), $needles)) {
  19326. foreach ($package->getConflicts() as $link) {
  19327. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  19328. $version = new Constraint('=', $pkg->getVersion());
  19329. if ($link->getConstraint()->matches($version) === $invert) {
  19330. $results[] = array($package, $link, false);
  19331. }
  19332. }
  19333. }
  19334. }
  19335. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  19336. foreach ($package->getRequires() as $link) {
  19337. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  19338. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  19339. continue;
  19340. }
  19341. $platformPkg = $this->findPackage($link->getTarget(), '*');
  19342. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  19343. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  19344. continue;
  19345. }
  19346. foreach ($this->getPackages() as $pkg) {
  19347. if (!in_array($link->getTarget(), $pkg->getNames())) {
  19348. continue;
  19349. }
  19350. $version = new Constraint('=', $pkg->getVersion());
  19351. if (!$link->getConstraint()->matches($version)) {
  19352. if ($rootPackage) {
  19353. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  19354. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  19355. $results[] = array($package, $link, false);
  19356. $results[] = array($rootPackage, $rootReq, false);
  19357. continue 3;
  19358. }
  19359. }
  19360. $results[] = array($package, $link, false);
  19361. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  19362. } else {
  19363. $results[] = array($package, $link, false);
  19364. }
  19365. }
  19366. continue 2;
  19367. }
  19368. }
  19369. }
  19370. }
  19371. ksort($results);
  19372. return $results;
  19373. }
  19374. }
  19375. <?php
  19376. namespace Composer\Repository;
  19377. use Composer\Package\Loader\ArrayLoader;
  19378. use Composer\Package\PackageInterface;
  19379. use Composer\Package\AliasPackage;
  19380. use Composer\Package\Version\VersionParser;
  19381. use Composer\DependencyResolver\Pool;
  19382. use Composer\Json\JsonFile;
  19383. use Composer\Cache;
  19384. use Composer\Config;
  19385. use Composer\Factory;
  19386. use Composer\IO\IOInterface;
  19387. use Composer\Util\RemoteFilesystem;
  19388. use Composer\Plugin\PluginEvents;
  19389. use Composer\Plugin\PreFileDownloadEvent;
  19390. use Composer\EventDispatcher\EventDispatcher;
  19391. use Composer\Downloader\TransportException;
  19392. use Composer\Semver\Constraint\ConstraintInterface;
  19393. use Composer\Semver\Constraint\Constraint;
  19394. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19395. {
  19396. protected $config;
  19397. protected $repoConfig;
  19398. protected $options;
  19399. protected $url;
  19400. protected $baseUrl;
  19401. protected $io;
  19402. protected $rfs;
  19403. protected $cache;
  19404. protected $notifyUrl;
  19405. protected $searchUrl;
  19406. protected $hasProviders = false;
  19407. protected $providersUrl;
  19408. protected $lazyProvidersUrl;
  19409. protected $providerListing;
  19410. protected $providers = array();
  19411. protected $providersByUid = array();
  19412. protected $loader;
  19413. protected $rootAliases;
  19414. protected $allowSslDowngrade = false;
  19415. protected $eventDispatcher;
  19416. protected $sourceMirrors;
  19417. protected $distMirrors;
  19418. private $degradedMode = false;
  19419. private $rootData;
  19420. private $hasPartialPackages;
  19421. private $partialPackagesByName;
  19422. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  19423. {
  19424. parent::__construct();
  19425. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  19426. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  19427. }
  19428. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  19429. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  19430. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  19431. }
  19432. $urlBits = parse_url($repoConfig['url']);
  19433. if ($urlBits === false || empty($urlBits['scheme'])) {
  19434. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  19435. }
  19436. if (!isset($repoConfig['options'])) {
  19437. $repoConfig['options'] = array();
  19438. }
  19439. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  19440. $this->allowSslDowngrade = true;
  19441. }
  19442. $this->config = $config;
  19443. $this->options = $repoConfig['options'];
  19444. $this->url = $repoConfig['url'];
  19445. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  19446. $this->io = $io;
  19447. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  19448. $this->loader = new ArrayLoader();
  19449. if ($rfs && $this->options) {
  19450. $rfs = clone $rfs;
  19451. $rfs->setOptions($this->options);
  19452. }
  19453. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  19454. $this->eventDispatcher = $eventDispatcher;
  19455. $this->repoConfig = $repoConfig;
  19456. }
  19457. public function getRepoConfig()
  19458. {
  19459. return $this->repoConfig;
  19460. }
  19461. public function setRootAliases(array $rootAliases)
  19462. {
  19463. $this->rootAliases = $rootAliases;
  19464. }
  19465. public function findPackage($name, $constraint)
  19466. {
  19467. if (!$this->hasProviders()) {
  19468. return parent::findPackage($name, $constraint);
  19469. }
  19470. $name = strtolower($name);
  19471. if (!$constraint instanceof ConstraintInterface) {
  19472. $versionParser = new VersionParser();
  19473. $constraint = $versionParser->parseConstraints($constraint);
  19474. }
  19475. foreach ($this->getProviderNames() as $providerName) {
  19476. if ($name === $providerName) {
  19477. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  19478. foreach ($packages as $package) {
  19479. if ($name === $package->getName()) {
  19480. $pkgConstraint = new Constraint('==', $package->getVersion());
  19481. if ($constraint->matches($pkgConstraint)) {
  19482. return $package;
  19483. }
  19484. }
  19485. }
  19486. break;
  19487. }
  19488. }
  19489. }
  19490. public function findPackages($name, $constraint = null)
  19491. {
  19492. if (!$this->hasProviders()) {
  19493. return parent::findPackages($name, $constraint);
  19494. }
  19495. $name = strtolower($name);
  19496. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19497. $versionParser = new VersionParser();
  19498. $constraint = $versionParser->parseConstraints($constraint);
  19499. }
  19500. $packages = array();
  19501. foreach ($this->getProviderNames() as $providerName) {
  19502. if ($name === $providerName) {
  19503. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  19504. foreach ($candidates as $package) {
  19505. if ($name === $package->getName()) {
  19506. $pkgConstraint = new Constraint('==', $package->getVersion());
  19507. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19508. $packages[] = $package;
  19509. }
  19510. }
  19511. }
  19512. break;
  19513. }
  19514. }
  19515. return $packages;
  19516. }
  19517. public function getPackages()
  19518. {
  19519. if ($this->hasProviders()) {
  19520. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  19521. }
  19522. return parent::getPackages();
  19523. }
  19524. public function search($query, $mode = 0, $type = null)
  19525. {
  19526. $this->loadRootServerFile();
  19527. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  19528. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  19529. $hostname = parse_url($url, PHP_URL_HOST) ?: $url;
  19530. $json = $this->rfs->getContents($hostname, $url, false);
  19531. $results = JsonFile::parseJson($json, $url);
  19532. return $results['results'];
  19533. }
  19534. if ($this->hasProviders()) {
  19535. $results = array();
  19536. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19537. foreach ($this->getProviderNames() as $name) {
  19538. if (preg_match($regex, $name)) {
  19539. $results[] = array('name' => $name);
  19540. }
  19541. }
  19542. return $results;
  19543. }
  19544. return parent::search($query, $mode);
  19545. }
  19546. public function getProviderNames()
  19547. {
  19548. $this->loadRootServerFile();
  19549. if (null === $this->providerListing) {
  19550. $this->loadProviderListings($this->loadRootServerFile());
  19551. }
  19552. if ($this->lazyProvidersUrl) {
  19553. return array();
  19554. }
  19555. if ($this->providersUrl) {
  19556. return array_keys($this->providerListing);
  19557. }
  19558. return array();
  19559. }
  19560. protected function configurePackageTransportOptions(PackageInterface $package)
  19561. {
  19562. foreach ($package->getDistUrls() as $url) {
  19563. if (strpos($url, $this->baseUrl) === 0) {
  19564. $package->setTransportOptions($this->options);
  19565. return;
  19566. }
  19567. }
  19568. }
  19569. public function hasProviders()
  19570. {
  19571. $this->loadRootServerFile();
  19572. return $this->hasProviders;
  19573. }
  19574. public function resetPackageIds()
  19575. {
  19576. foreach ($this->providersByUid as $package) {
  19577. if ($package instanceof AliasPackage) {
  19578. $package->getAliasOf()->setId(-1);
  19579. }
  19580. $package->setId(-1);
  19581. }
  19582. }
  19583. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  19584. {
  19585. if (isset($this->providers[$name]) && !$bypassFilters) {
  19586. return $this->providers[$name];
  19587. }
  19588. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  19589. $this->initializePartialPackages();
  19590. }
  19591. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  19592. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  19593. return array();
  19594. }
  19595. if (null === $this->providerListing) {
  19596. $this->loadProviderListings($this->loadRootServerFile());
  19597. }
  19598. $useLastModifiedCheck = false;
  19599. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  19600. $hash = null;
  19601. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  19602. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  19603. $useLastModifiedCheck = true;
  19604. } elseif ($this->providersUrl) {
  19605. if (!isset($this->providerListing[$name])) {
  19606. return array();
  19607. }
  19608. $hash = $this->providerListing[$name]['sha256'];
  19609. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  19610. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  19611. } else {
  19612. return array();
  19613. }
  19614. $packages = null;
  19615. if ($cacheKey) {
  19616. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  19617. $packages = json_decode($this->cache->read($cacheKey), true);
  19618. } elseif ($useLastModifiedCheck) {
  19619. if ($contents = $this->cache->read($cacheKey)) {
  19620. $contents = json_decode($contents, true);
  19621. if (isset($contents['last-modified'])) {
  19622. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  19623. if (true === $response) {
  19624. $packages = $contents;
  19625. } elseif ($response) {
  19626. $packages = $response;
  19627. }
  19628. }
  19629. }
  19630. }
  19631. }
  19632. if (!$packages) {
  19633. try {
  19634. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  19635. } catch (TransportException $e) {
  19636. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  19637. $packages = array('packages' => array());
  19638. } else {
  19639. throw $e;
  19640. }
  19641. }
  19642. }
  19643. $loadingPartialPackage = false;
  19644. } else {
  19645. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  19646. $loadingPartialPackage = true;
  19647. }
  19648. $this->providers[$name] = array();
  19649. foreach ($packages['packages'] as $versions) {
  19650. foreach ($versions as $version) {
  19651. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  19652. continue;
  19653. }
  19654. if (isset($this->providersByUid[$version['uid']])) {
  19655. if (!isset($this->providers[$name][$version['uid']])) {
  19656. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  19657. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  19658. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  19659. } else {
  19660. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  19661. }
  19662. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  19663. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  19664. }
  19665. }
  19666. } else {
  19667. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  19668. continue;
  19669. }
  19670. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  19671. $package->setRepository($this);
  19672. if ($package instanceof AliasPackage) {
  19673. $aliased = $package->getAliasOf();
  19674. $aliased->setRepository($this);
  19675. $this->providers[$name][$version['uid']] = $aliased;
  19676. $this->providers[$name][$version['uid'].'-alias'] = $package;
  19677. $this->providersByUid[$version['uid']] = $package;
  19678. } else {
  19679. $this->providers[$name][$version['uid']] = $package;
  19680. $this->providersByUid[$version['uid']] = $package;
  19681. }
  19682. unset($rootAliasData);
  19683. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  19684. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  19685. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  19686. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  19687. }
  19688. if (isset($rootAliasData)) {
  19689. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  19690. $alias->setRepository($this);
  19691. $this->providers[$name][$version['uid'].'-root'] = $alias;
  19692. $this->providersByUid[$version['uid'].'-root'] = $alias;
  19693. }
  19694. }
  19695. }
  19696. }
  19697. $result = $this->providers[$name];
  19698. if ($bypassFilters) {
  19699. foreach ($this->providers[$name] as $uid => $provider) {
  19700. unset($this->providersByUid[$uid]);
  19701. }
  19702. unset($this->providers[$name]);
  19703. }
  19704. return $result;
  19705. }
  19706. protected function initialize()
  19707. {
  19708. parent::initialize();
  19709. $repoData = $this->loadDataFromServer();
  19710. foreach ($repoData as $package) {
  19711. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  19712. }
  19713. }
  19714. public function addPackage(PackageInterface $package)
  19715. {
  19716. parent::addPackage($package);
  19717. $this->configurePackageTransportOptions($package);
  19718. }
  19719. protected function loadRootServerFile()
  19720. {
  19721. if (null !== $this->rootData) {
  19722. return $this->rootData;
  19723. }
  19724. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  19725. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  19726. }
  19727. $jsonUrlParts = parse_url($this->url);
  19728. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  19729. $jsonUrl = $this->url;
  19730. } else {
  19731. $jsonUrl = $this->url . '/packages.json';
  19732. }
  19733. $data = $this->fetchFile($jsonUrl, 'packages.json');
  19734. if (!empty($data['notify-batch'])) {
  19735. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  19736. } elseif (!empty($data['notify'])) {
  19737. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  19738. }
  19739. if (!empty($data['search'])) {
  19740. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  19741. }
  19742. if (!empty($data['mirrors'])) {
  19743. foreach ($data['mirrors'] as $mirror) {
  19744. if (!empty($mirror['git-url'])) {
  19745. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  19746. }
  19747. if (!empty($mirror['hg-url'])) {
  19748. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  19749. }
  19750. if (!empty($mirror['dist-url'])) {
  19751. $this->distMirrors[] = array(
  19752. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  19753. 'preferred' => !empty($mirror['preferred']),
  19754. );
  19755. }
  19756. }
  19757. }
  19758. if (!empty($data['providers-lazy-url'])) {
  19759. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  19760. $this->hasProviders = true;
  19761. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  19762. }
  19763. if ($this->allowSslDowngrade) {
  19764. $this->url = str_replace('https://', 'http://', $this->url);
  19765. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  19766. }
  19767. if (!empty($data['providers-url'])) {
  19768. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  19769. $this->hasProviders = true;
  19770. }
  19771. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  19772. $this->hasProviders = true;
  19773. }
  19774. if (preg_match('{^https?://packagist.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  19775. $this->url = 'https://packagist.org';
  19776. $this->baseUrl = 'https://packagist.org';
  19777. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://packagist.org/p/%package%.json');
  19778. $this->providersUrl = null;
  19779. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  19780. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  19781. $this->providersUrl = null;
  19782. }
  19783. return $this->rootData = $data;
  19784. }
  19785. protected function canonicalizeUrl($url)
  19786. {
  19787. if ('/' === $url[0]) {
  19788. return preg_replace('{(https?://[^/]+).*}i', '$1' . $url, $this->url);
  19789. }
  19790. return $url;
  19791. }
  19792. protected function loadDataFromServer()
  19793. {
  19794. $data = $this->loadRootServerFile();
  19795. return $this->loadIncludes($data);
  19796. }
  19797. protected function loadProviderListings($data)
  19798. {
  19799. if (isset($data['providers'])) {
  19800. if (!is_array($this->providerListing)) {
  19801. $this->providerListing = array();
  19802. }
  19803. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  19804. }
  19805. if ($this->providersUrl && isset($data['provider-includes'])) {
  19806. $includes = $data['provider-includes'];
  19807. foreach ($includes as $include => $metadata) {
  19808. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  19809. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  19810. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  19811. $includedData = json_decode($this->cache->read($cacheKey), true);
  19812. } else {
  19813. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  19814. }
  19815. $this->loadProviderListings($includedData);
  19816. }
  19817. }
  19818. }
  19819. protected function loadIncludes($data)
  19820. {
  19821. $packages = array();
  19822. if (!isset($data['packages']) && !isset($data['includes'])) {
  19823. foreach ($data as $pkg) {
  19824. foreach ($pkg['versions'] as $metadata) {
  19825. $packages[] = $metadata;
  19826. }
  19827. }
  19828. return $packages;
  19829. }
  19830. if (isset($data['packages'])) {
  19831. foreach ($data['packages'] as $package => $versions) {
  19832. foreach ($versions as $version => $metadata) {
  19833. $packages[] = $metadata;
  19834. }
  19835. }
  19836. }
  19837. if (isset($data['includes'])) {
  19838. foreach ($data['includes'] as $include => $metadata) {
  19839. if ($this->cache->sha1($include) === $metadata['sha1']) {
  19840. $includedData = json_decode($this->cache->read($include), true);
  19841. } else {
  19842. $includedData = $this->fetchFile($include);
  19843. }
  19844. $packages = array_merge($packages, $this->loadIncludes($includedData));
  19845. }
  19846. }
  19847. return $packages;
  19848. }
  19849. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  19850. {
  19851. try {
  19852. if (!isset($data['notification-url'])) {
  19853. $data['notification-url'] = $this->notifyUrl;
  19854. }
  19855. $package = $this->loader->load($data, $class);
  19856. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  19857. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  19858. }
  19859. $package->setDistMirrors($this->distMirrors);
  19860. $this->configurePackageTransportOptions($package);
  19861. return $package;
  19862. } catch (\Exception $e) {
  19863. 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);
  19864. }
  19865. }
  19866. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  19867. {
  19868. if (null === $cacheKey) {
  19869. $cacheKey = $filename;
  19870. $filename = $this->baseUrl.'/'.$filename;
  19871. }
  19872. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  19873. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  19874. }
  19875. $retries = 3;
  19876. while ($retries--) {
  19877. try {
  19878. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  19879. if ($this->eventDispatcher) {
  19880. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  19881. }
  19882. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  19883. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  19884. $json = $rfs->getContents($hostname, $filename, false);
  19885. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  19886. if ($this->allowSslDowngrade) {
  19887. $this->url = str_replace('http://', 'https://', $this->url);
  19888. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  19889. $filename = str_replace('http://', 'https://', $filename);
  19890. }
  19891. if ($retries) {
  19892. usleep(100000);
  19893. continue;
  19894. }
  19895. 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.');
  19896. }
  19897. $data = JsonFile::parseJson($json, $filename);
  19898. if (!empty($data['warning'])) {
  19899. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  19900. }
  19901. if (!empty($data['info'])) {
  19902. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  19903. }
  19904. if ($cacheKey) {
  19905. if ($storeLastModifiedTime) {
  19906. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  19907. if ($lastModifiedDate) {
  19908. $data['last-modified'] = $lastModifiedDate;
  19909. $json = json_encode($data);
  19910. }
  19911. }
  19912. $this->cache->write($cacheKey, $json);
  19913. }
  19914. break;
  19915. } catch (\Exception $e) {
  19916. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  19917. throw $e;
  19918. }
  19919. if ($retries) {
  19920. usleep(100000);
  19921. continue;
  19922. }
  19923. if ($e instanceof RepositorySecurityException) {
  19924. throw $e;
  19925. }
  19926. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  19927. if (!$this->degradedMode) {
  19928. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  19929. $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>');
  19930. }
  19931. $this->degradedMode = true;
  19932. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  19933. break;
  19934. }
  19935. throw $e;
  19936. }
  19937. }
  19938. return $data;
  19939. }
  19940. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  19941. {
  19942. $retries = 3;
  19943. while ($retries--) {
  19944. try {
  19945. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  19946. if ($this->eventDispatcher) {
  19947. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  19948. }
  19949. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  19950. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  19951. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  19952. $json = $rfs->getContents($hostname, $filename, false, $options);
  19953. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  19954. return true;
  19955. }
  19956. $data = JsonFile::parseJson($json, $filename);
  19957. if (!empty($data['warning'])) {
  19958. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  19959. }
  19960. if (!empty($data['info'])) {
  19961. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  19962. }
  19963. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  19964. if ($lastModifiedDate) {
  19965. $data['last-modified'] = $lastModifiedDate;
  19966. $json = json_encode($data);
  19967. }
  19968. $this->cache->write($cacheKey, $json);
  19969. return $data;
  19970. } catch (\Exception $e) {
  19971. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  19972. throw $e;
  19973. }
  19974. if ($retries) {
  19975. usleep(100000);
  19976. continue;
  19977. }
  19978. if (!$this->degradedMode) {
  19979. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  19980. $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>');
  19981. }
  19982. $this->degradedMode = true;
  19983. return true;
  19984. }
  19985. }
  19986. }
  19987. private function initializePartialPackages()
  19988. {
  19989. $rootData = $this->loadRootServerFile();
  19990. $this->partialPackagesByName = array();
  19991. foreach ($rootData['packages'] as $package => $versions) {
  19992. $package = strtolower($package);
  19993. foreach ($versions as $version) {
  19994. $this->partialPackagesByName[$package][] = $version;
  19995. if (!empty($version['provide']) && is_array($version['provide'])) {
  19996. foreach ($version['provide'] as $provided => $providedVersion) {
  19997. $this->partialPackagesByName[strtolower($provided)][] = $version;
  19998. }
  19999. }
  20000. if (!empty($version['replace']) && is_array($version['replace'])) {
  20001. foreach ($version['replace'] as $provided => $providedVersion) {
  20002. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20003. }
  20004. }
  20005. }
  20006. }
  20007. $this->rootData = true;
  20008. }
  20009. }
  20010. <?php
  20011. namespace Composer\Repository;
  20012. use Composer\Package\PackageInterface;
  20013. class CompositeRepository extends BaseRepository
  20014. {
  20015. private $repositories;
  20016. public function __construct(array $repositories)
  20017. {
  20018. $this->repositories = array();
  20019. foreach ($repositories as $repo) {
  20020. $this->addRepository($repo);
  20021. }
  20022. }
  20023. public function getRepositories()
  20024. {
  20025. return $this->repositories;
  20026. }
  20027. public function hasPackage(PackageInterface $package)
  20028. {
  20029. foreach ($this->repositories as $repository) {
  20030. if ($repository->hasPackage($package)) {
  20031. return true;
  20032. }
  20033. }
  20034. return false;
  20035. }
  20036. public function findPackage($name, $constraint)
  20037. {
  20038. foreach ($this->repositories as $repository) {
  20039. $package = $repository->findPackage($name, $constraint);
  20040. if (null !== $package) {
  20041. return $package;
  20042. }
  20043. }
  20044. return null;
  20045. }
  20046. public function findPackages($name, $constraint = null)
  20047. {
  20048. $packages = array();
  20049. foreach ($this->repositories as $repository) {
  20050. $packages[] = $repository->findPackages($name, $constraint);
  20051. }
  20052. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20053. }
  20054. public function search($query, $mode = 0, $type = null)
  20055. {
  20056. $matches = array();
  20057. foreach ($this->repositories as $repository) {
  20058. $matches[] = $repository->search($query, $mode, $type);
  20059. }
  20060. return $matches ? call_user_func_array('array_merge', $matches) : array();
  20061. }
  20062. public function getPackages()
  20063. {
  20064. $packages = array();
  20065. foreach ($this->repositories as $repository) {
  20066. $packages[] = $repository->getPackages();
  20067. }
  20068. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20069. }
  20070. public function removePackage(PackageInterface $package)
  20071. {
  20072. foreach ($this->repositories as $repository) {
  20073. $repository->removePackage($package);
  20074. }
  20075. }
  20076. public function count()
  20077. {
  20078. $total = 0;
  20079. foreach ($this->repositories as $repository) {
  20080. $total += $repository->count();
  20081. }
  20082. return $total;
  20083. }
  20084. public function addRepository(RepositoryInterface $repository)
  20085. {
  20086. if ($repository instanceof self) {
  20087. foreach ($repository->getRepositories() as $repo) {
  20088. $this->addRepository($repo);
  20089. }
  20090. } else {
  20091. $this->repositories[] = $repository;
  20092. }
  20093. }
  20094. }
  20095. <?php
  20096. namespace Composer\Repository;
  20097. interface ConfigurableRepositoryInterface
  20098. {
  20099. public function getRepoConfig();
  20100. }
  20101. <?php
  20102. namespace Composer\Repository;
  20103. use Composer\Json\JsonFile;
  20104. use Composer\Package\Loader\ArrayLoader;
  20105. use Composer\Package\Dumper\ArrayDumper;
  20106. class FilesystemRepository extends WritableArrayRepository
  20107. {
  20108. private $file;
  20109. public function __construct(JsonFile $repositoryFile)
  20110. {
  20111. parent::__construct();
  20112. $this->file = $repositoryFile;
  20113. }
  20114. protected function initialize()
  20115. {
  20116. parent::initialize();
  20117. if (!$this->file->exists()) {
  20118. return;
  20119. }
  20120. try {
  20121. $packages = $this->file->read();
  20122. if (!is_array($packages)) {
  20123. throw new \UnexpectedValueException('Could not parse package list from the repository');
  20124. }
  20125. } catch (\Exception $e) {
  20126. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  20127. }
  20128. $loader = new ArrayLoader(null, true);
  20129. foreach ($packages as $packageData) {
  20130. $package = $loader->load($packageData);
  20131. $this->addPackage($package);
  20132. }
  20133. }
  20134. public function reload()
  20135. {
  20136. $this->packages = null;
  20137. $this->initialize();
  20138. }
  20139. public function write()
  20140. {
  20141. $data = array();
  20142. $dumper = new ArrayDumper();
  20143. foreach ($this->getCanonicalPackages() as $package) {
  20144. $data[] = $dumper->dump($package);
  20145. }
  20146. usort($data, function ($a, $b) {
  20147. return strcmp($a['name'], $b['name']);
  20148. });
  20149. $this->file->write($data);
  20150. }
  20151. }
  20152. <?php
  20153. namespace Composer\Repository;
  20154. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  20155. {
  20156. }
  20157. <?php
  20158. namespace Composer\Repository;
  20159. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  20160. {
  20161. }
  20162. <?php
  20163. namespace Composer\Repository;
  20164. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  20165. {
  20166. }
  20167. <?php
  20168. namespace Composer\Repository;
  20169. class InvalidRepositoryException extends \Exception
  20170. {
  20171. }
  20172. <?php
  20173. namespace Composer\Repository;
  20174. use Composer\Package\Loader\ArrayLoader;
  20175. use Composer\Package\Loader\ValidatingArrayLoader;
  20176. class PackageRepository extends ArrayRepository
  20177. {
  20178. private $config;
  20179. public function __construct(array $config)
  20180. {
  20181. parent::__construct();
  20182. $this->config = $config['package'];
  20183. if (!is_numeric(key($this->config))) {
  20184. $this->config = array($this->config);
  20185. }
  20186. }
  20187. protected function initialize()
  20188. {
  20189. parent::initialize();
  20190. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  20191. foreach ($this->config as $package) {
  20192. try {
  20193. $package = $loader->load($package);
  20194. } catch (\Exception $e) {
  20195. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  20196. }
  20197. $this->addPackage($package);
  20198. }
  20199. }
  20200. }
  20201. <?php
  20202. namespace Composer\Repository;
  20203. use Composer\Config;
  20204. use Composer\IO\IOInterface;
  20205. use Composer\Json\JsonFile;
  20206. use Composer\Package\Loader\ArrayLoader;
  20207. use Composer\Package\Version\VersionGuesser;
  20208. use Composer\Package\Version\VersionParser;
  20209. use Composer\Util\Platform;
  20210. use Composer\Util\ProcessExecutor;
  20211. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20212. {
  20213. private $loader;
  20214. private $versionGuesser;
  20215. private $url;
  20216. private $repoConfig;
  20217. private $process;
  20218. private $options;
  20219. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  20220. {
  20221. if (!isset($repoConfig['url'])) {
  20222. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  20223. }
  20224. $this->loader = new ArrayLoader(null, true);
  20225. $this->url = Platform::expandPath($repoConfig['url']);
  20226. $this->process = new ProcessExecutor($io);
  20227. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  20228. $this->repoConfig = $repoConfig;
  20229. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  20230. parent::__construct();
  20231. }
  20232. public function getRepoConfig()
  20233. {
  20234. return $this->repoConfig;
  20235. }
  20236. protected function initialize()
  20237. {
  20238. parent::initialize();
  20239. foreach ($this->getUrlMatches() as $url) {
  20240. $path = realpath($url) . DIRECTORY_SEPARATOR;
  20241. $composerFilePath = $path.'composer.json';
  20242. if (!file_exists($composerFilePath)) {
  20243. continue;
  20244. }
  20245. $json = file_get_contents($composerFilePath);
  20246. $package = JsonFile::parseJson($json, $composerFilePath);
  20247. $package['dist'] = array(
  20248. 'type' => 'path',
  20249. 'url' => $url,
  20250. 'reference' => sha1($json . serialize($this->options)),
  20251. );
  20252. $package['transport-options'] = $this->options;
  20253. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  20254. if (
  20255. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  20256. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  20257. && $ref1 === $ref2
  20258. ) {
  20259. $package['version'] = $rootVersion;
  20260. }
  20261. }
  20262. if (!isset($package['version'])) {
  20263. $versionData = $this->versionGuesser->guessVersion($package, $path);
  20264. $package['version'] = $versionData['version'] ?: 'dev-master';
  20265. }
  20266. $output = '';
  20267. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  20268. $package['dist']['reference'] = trim($output);
  20269. }
  20270. $package = $this->loader->load($package);
  20271. $this->addPackage($package);
  20272. }
  20273. }
  20274. private function getUrlMatches()
  20275. {
  20276. return array_map(function ($val) {
  20277. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  20278. }, glob($this->url, GLOB_MARK | GLOB_ONLYDIR));
  20279. }
  20280. }
  20281. <?php
  20282. namespace Composer\Repository\Pear;
  20283. use Composer\Util\RemoteFilesystem;
  20284. abstract class BaseChannelReader
  20285. {
  20286. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  20287. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  20288. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  20289. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  20290. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  20291. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  20292. private $rfs;
  20293. protected function __construct(RemoteFilesystem $rfs)
  20294. {
  20295. $this->rfs = $rfs;
  20296. }
  20297. protected function requestContent($origin, $path)
  20298. {
  20299. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  20300. $content = $this->rfs->getContents($origin, $url, false);
  20301. if (!$content) {
  20302. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  20303. }
  20304. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  20305. }
  20306. protected function requestXml($origin, $path)
  20307. {
  20308. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  20309. if (false === $xml) {
  20310. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  20311. }
  20312. return $xml;
  20313. }
  20314. }
  20315. <?php
  20316. namespace Composer\Repository\Pear;
  20317. class ChannelInfo
  20318. {
  20319. private $name;
  20320. private $alias;
  20321. private $packages;
  20322. public function __construct($name, $alias, array $packages)
  20323. {
  20324. $this->name = $name;
  20325. $this->alias = $alias;
  20326. $this->packages = $packages;
  20327. }
  20328. public function getName()
  20329. {
  20330. return $this->name;
  20331. }
  20332. public function getAlias()
  20333. {
  20334. return $this->alias;
  20335. }
  20336. public function getPackages()
  20337. {
  20338. return $this->packages;
  20339. }
  20340. }
  20341. <?php
  20342. namespace Composer\Repository\Pear;
  20343. use Composer\Util\RemoteFilesystem;
  20344. class ChannelReader extends BaseChannelReader
  20345. {
  20346. private $readerMap;
  20347. public function __construct(RemoteFilesystem $rfs)
  20348. {
  20349. parent::__construct($rfs);
  20350. $rest10reader = new ChannelRest10Reader($rfs);
  20351. $rest11reader = new ChannelRest11Reader($rfs);
  20352. $this->readerMap = array(
  20353. 'REST1.3' => $rest11reader,
  20354. 'REST1.2' => $rest11reader,
  20355. 'REST1.1' => $rest11reader,
  20356. 'REST1.0' => $rest10reader,
  20357. );
  20358. }
  20359. public function read($url)
  20360. {
  20361. $xml = $this->requestXml($url, "/channel.xml");
  20362. $channelName = (string) $xml->name;
  20363. $channelAlias = (string) $xml->suggestedalias;
  20364. $supportedVersions = array_keys($this->readerMap);
  20365. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  20366. if (!$selectedRestVersion) {
  20367. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  20368. }
  20369. $reader = $this->readerMap[$selectedRestVersion['version']];
  20370. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  20371. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  20372. }
  20373. private function selectRestVersion($channelXml, $supportedVersions)
  20374. {
  20375. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  20376. foreach ($supportedVersions as $version) {
  20377. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  20378. $testResult = $channelXml->xpath($xpathTest);
  20379. foreach ($testResult as $result) {
  20380. $result = (string) $result;
  20381. if (preg_match('{^https://}i', $result)) {
  20382. return array('version' => $version, 'baseUrl' => $result);
  20383. }
  20384. }
  20385. if (count($testResult) > 0) {
  20386. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  20387. }
  20388. }
  20389. return null;
  20390. }
  20391. }
  20392. <?php
  20393. namespace Composer\Repository\Pear;
  20394. use Composer\Downloader\TransportException;
  20395. class ChannelRest10Reader extends BaseChannelReader
  20396. {
  20397. private $dependencyReader;
  20398. public function __construct($rfs)
  20399. {
  20400. parent::__construct($rfs);
  20401. $this->dependencyReader = new PackageDependencyParser();
  20402. }
  20403. public function read($baseUrl)
  20404. {
  20405. return $this->readPackages($baseUrl);
  20406. }
  20407. private function readPackages($baseUrl)
  20408. {
  20409. $result = array();
  20410. $xmlPath = '/p/packages.xml';
  20411. $xml = $this->requestXml($baseUrl, $xmlPath);
  20412. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  20413. foreach ($xml->xpath('ns:p') as $node) {
  20414. $packageName = (string) $node;
  20415. $packageInfo = $this->readPackage($baseUrl, $packageName);
  20416. $result[] = $packageInfo;
  20417. }
  20418. return $result;
  20419. }
  20420. private function readPackage($baseUrl, $packageName)
  20421. {
  20422. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  20423. $xml = $this->requestXml($baseUrl, $xmlPath);
  20424. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  20425. $channelName = (string) $xml->c;
  20426. $packageName = (string) $xml->n;
  20427. $license = (string) $xml->l;
  20428. $shortDescription = (string) $xml->s;
  20429. $description = (string) $xml->d;
  20430. return new PackageInfo(
  20431. $channelName,
  20432. $packageName,
  20433. $license,
  20434. $shortDescription,
  20435. $description,
  20436. $this->readPackageReleases($baseUrl, $packageName)
  20437. );
  20438. }
  20439. private function readPackageReleases($baseUrl, $packageName)
  20440. {
  20441. $result = array();
  20442. try {
  20443. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  20444. $xml = $this->requestXml($baseUrl, $xmlPath);
  20445. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  20446. foreach ($xml->xpath('ns:r') as $node) {
  20447. $releaseVersion = (string) $node->v;
  20448. $releaseStability = (string) $node->s;
  20449. try {
  20450. $result[$releaseVersion] = new ReleaseInfo(
  20451. $releaseStability,
  20452. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  20453. );
  20454. } catch (TransportException $exception) {
  20455. if ($exception->getCode() != 404) {
  20456. throw $exception;
  20457. }
  20458. }
  20459. }
  20460. } catch (TransportException $exception) {
  20461. if ($exception->getCode() != 404) {
  20462. throw $exception;
  20463. }
  20464. }
  20465. return $result;
  20466. }
  20467. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  20468. {
  20469. $dependencyReader = new PackageDependencyParser();
  20470. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  20471. $content = $this->requestContent($baseUrl, $depthPath);
  20472. $dependencyArray = unserialize($content);
  20473. return $dependencyReader->buildDependencyInfo($dependencyArray);
  20474. }
  20475. }
  20476. <?php
  20477. namespace Composer\Repository\Pear;
  20478. class ChannelRest11Reader extends BaseChannelReader
  20479. {
  20480. private $dependencyReader;
  20481. public function __construct($rfs)
  20482. {
  20483. parent::__construct($rfs);
  20484. $this->dependencyReader = new PackageDependencyParser();
  20485. }
  20486. public function read($baseUrl)
  20487. {
  20488. return $this->readChannelPackages($baseUrl);
  20489. }
  20490. private function readChannelPackages($baseUrl)
  20491. {
  20492. $result = array();
  20493. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  20494. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  20495. foreach ($xml->xpath('ns:c') as $node) {
  20496. $categoryName = (string) $node;
  20497. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  20498. $result = array_merge($result, $categoryPackages);
  20499. }
  20500. return $result;
  20501. }
  20502. private function readCategoryPackages($baseUrl, $categoryName)
  20503. {
  20504. $result = array();
  20505. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  20506. $xml = $this->requestXml($baseUrl, $categoryPath);
  20507. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  20508. foreach ($xml->xpath('ns:pi') as $node) {
  20509. $packageInfo = $this->parsePackage($node);
  20510. $result[] = $packageInfo;
  20511. }
  20512. return $result;
  20513. }
  20514. private function parsePackage($packageInfo)
  20515. {
  20516. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  20517. $channelName = (string) $packageInfo->p->c;
  20518. $packageName = (string) $packageInfo->p->n;
  20519. $license = (string) $packageInfo->p->l;
  20520. $shortDescription = (string) $packageInfo->p->s;
  20521. $description = (string) $packageInfo->p->d;
  20522. $dependencies = array();
  20523. foreach ($packageInfo->xpath('ns:deps') as $node) {
  20524. $dependencyVersion = (string) $node->v;
  20525. $dependencyArray = unserialize((string) $node->d);
  20526. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  20527. $dependencies[$dependencyVersion] = $dependencyInfo;
  20528. }
  20529. $releases = array();
  20530. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  20531. if ($releasesInfo) {
  20532. foreach ($releasesInfo as $node) {
  20533. $releaseVersion = (string) $node->v;
  20534. $releaseStability = (string) $node->s;
  20535. $releases[$releaseVersion] = new ReleaseInfo(
  20536. $releaseStability,
  20537. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  20538. );
  20539. }
  20540. }
  20541. return new PackageInfo(
  20542. $channelName,
  20543. $packageName,
  20544. $license,
  20545. $shortDescription,
  20546. $description,
  20547. $releases
  20548. );
  20549. }
  20550. }
  20551. <?php
  20552. namespace Composer\Repository\Pear;
  20553. class DependencyConstraint
  20554. {
  20555. private $type;
  20556. private $constraint;
  20557. private $channelName;
  20558. private $packageName;
  20559. public function __construct($type, $constraint, $channelName, $packageName)
  20560. {
  20561. $this->type = $type;
  20562. $this->constraint = $constraint;
  20563. $this->channelName = $channelName;
  20564. $this->packageName = $packageName;
  20565. }
  20566. public function getChannelName()
  20567. {
  20568. return $this->channelName;
  20569. }
  20570. public function getConstraint()
  20571. {
  20572. return $this->constraint;
  20573. }
  20574. public function getPackageName()
  20575. {
  20576. return $this->packageName;
  20577. }
  20578. public function getType()
  20579. {
  20580. return $this->type;
  20581. }
  20582. }
  20583. <?php
  20584. namespace Composer\Repository\Pear;
  20585. class DependencyInfo
  20586. {
  20587. private $requires;
  20588. private $optionals;
  20589. public function __construct($requires, $optionals)
  20590. {
  20591. $this->requires = $requires;
  20592. $this->optionals = $optionals;
  20593. }
  20594. public function getRequires()
  20595. {
  20596. return $this->requires;
  20597. }
  20598. public function getOptionals()
  20599. {
  20600. return $this->optionals;
  20601. }
  20602. }
  20603. <?php
  20604. namespace Composer\Repository\Pear;
  20605. class PackageDependencyParser
  20606. {
  20607. public function buildDependencyInfo($depArray)
  20608. {
  20609. if (!is_array($depArray)) {
  20610. return new DependencyInfo(array(), array());
  20611. }
  20612. if (!$this->isHash($depArray)) {
  20613. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  20614. }
  20615. return $this->buildDependency20Info($depArray);
  20616. }
  20617. private function buildDependency10Info($depArray)
  20618. {
  20619. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  20620. $result = array();
  20621. foreach ($depArray as $depItem) {
  20622. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  20623. continue;
  20624. }
  20625. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  20626. ? 'optional'
  20627. : 'required';
  20628. $depType = 'not' == $depItem['rel']
  20629. ? 'conflicts'
  20630. : $depType;
  20631. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  20632. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  20633. ? '*'
  20634. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  20635. switch ($depItem['type']) {
  20636. case 'php':
  20637. $depChannelName = 'php';
  20638. $depPackageName = '';
  20639. break;
  20640. case 'pkg':
  20641. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  20642. $depPackageName = $depItem['name'];
  20643. break;
  20644. case 'ext':
  20645. $depChannelName = 'ext';
  20646. $depPackageName = $depItem['name'];
  20647. break;
  20648. case 'os':
  20649. case 'sapi':
  20650. $depChannelName = '';
  20651. $depPackageName = '';
  20652. break;
  20653. default:
  20654. $depChannelName = '';
  20655. $depPackageName = '';
  20656. break;
  20657. }
  20658. if ('' != $depChannelName) {
  20659. $result[] = new DependencyConstraint(
  20660. $depType,
  20661. $depVersionConstraint,
  20662. $depChannelName,
  20663. $depPackageName
  20664. );
  20665. }
  20666. }
  20667. return $result;
  20668. }
  20669. private function buildDependency20Info($depArray)
  20670. {
  20671. $result = array();
  20672. $optionals = array();
  20673. $defaultOptionals = array();
  20674. foreach ($depArray as $depType => $depTypeGroup) {
  20675. if (!is_array($depTypeGroup)) {
  20676. continue;
  20677. }
  20678. if ('required' == $depType || 'optional' == $depType) {
  20679. foreach ($depTypeGroup as $depItemType => $depItem) {
  20680. switch ($depItemType) {
  20681. case 'php':
  20682. $result[] = new DependencyConstraint(
  20683. $depType,
  20684. $this->parse20VersionConstraint($depItem),
  20685. 'php',
  20686. ''
  20687. );
  20688. break;
  20689. case 'package':
  20690. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  20691. $result = array_merge($result, $deps);
  20692. break;
  20693. case 'extension':
  20694. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  20695. $result = array_merge($result, $deps);
  20696. break;
  20697. case 'subpackage':
  20698. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  20699. $defaultOptionals += $deps;
  20700. break;
  20701. case 'os':
  20702. case 'pearinstaller':
  20703. break;
  20704. default:
  20705. break;
  20706. }
  20707. }
  20708. } elseif ('group' == $depType) {
  20709. if ($this->isHash($depTypeGroup)) {
  20710. $depTypeGroup = array($depTypeGroup);
  20711. }
  20712. foreach ($depTypeGroup as $depItem) {
  20713. $groupName = $depItem['attribs']['name'];
  20714. if (!isset($optionals[$groupName])) {
  20715. $optionals[$groupName] = array();
  20716. }
  20717. if (isset($depItem['subpackage'])) {
  20718. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  20719. } else {
  20720. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  20721. }
  20722. }
  20723. }
  20724. }
  20725. if (count($defaultOptionals) > 0) {
  20726. $optionals['*'] = $defaultOptionals;
  20727. }
  20728. return new DependencyInfo($result, $optionals);
  20729. }
  20730. private function buildDepExtensionConstraints($depItem, $depType)
  20731. {
  20732. if ($this->isHash($depItem)) {
  20733. $depItem = array($depItem);
  20734. }
  20735. $result = array();
  20736. foreach ($depItem as $subDepItem) {
  20737. $depChannelName = 'ext';
  20738. $depPackageName = $subDepItem['name'];
  20739. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  20740. $result[] = new DependencyConstraint(
  20741. $depType,
  20742. $depVersionConstraint,
  20743. $depChannelName,
  20744. $depPackageName
  20745. );
  20746. }
  20747. return $result;
  20748. }
  20749. private function buildDepPackageConstraints($depItem, $depType)
  20750. {
  20751. if ($this->isHash($depItem)) {
  20752. $depItem = array($depItem);
  20753. }
  20754. $result = array();
  20755. foreach ($depItem as $subDepItem) {
  20756. if (!array_key_exists('channel', $subDepItem)) {
  20757. $subDepItem['channel'] = $subDepItem['uri'];
  20758. }
  20759. $depChannelName = $subDepItem['channel'];
  20760. $depPackageName = $subDepItem['name'];
  20761. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  20762. if (isset($subDepItem['conflicts'])) {
  20763. $depType = 'conflicts';
  20764. }
  20765. $result[] = new DependencyConstraint(
  20766. $depType,
  20767. $depVersionConstraint,
  20768. $depChannelName,
  20769. $depPackageName
  20770. );
  20771. }
  20772. return $result;
  20773. }
  20774. private function parse20VersionConstraint(array $data)
  20775. {
  20776. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  20777. $versions = array();
  20778. $values = array_intersect_key($data, $dep20toOperatorMap);
  20779. if (0 == count($values)) {
  20780. return '*';
  20781. }
  20782. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  20783. $versions[] = '>' . $this->parseVersion($values['min']);
  20784. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  20785. $versions[] = '<' . $this->parseVersion($values['max']);
  20786. } else {
  20787. foreach ($values as $op => $version) {
  20788. if ('exclude' == $op && is_array($version)) {
  20789. foreach ($version as $versionPart) {
  20790. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  20791. }
  20792. } else {
  20793. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  20794. }
  20795. }
  20796. }
  20797. return implode(',', $versions);
  20798. }
  20799. private function parseVersion($version)
  20800. {
  20801. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  20802. $version = $matches[1]
  20803. .(!empty($matches[2]) ? $matches[2] : '.0')
  20804. .(!empty($matches[3]) ? $matches[3] : '.0')
  20805. .(!empty($matches[4]) ? $matches[4] : '.0');
  20806. return $version;
  20807. }
  20808. return null;
  20809. }
  20810. private function isHash(array $array)
  20811. {
  20812. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  20813. }
  20814. }
  20815. <?php
  20816. namespace Composer\Repository\Pear;
  20817. class PackageInfo
  20818. {
  20819. private $channelName;
  20820. private $packageName;
  20821. private $license;
  20822. private $shortDescription;
  20823. private $description;
  20824. private $releases;
  20825. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  20826. {
  20827. $this->channelName = $channelName;
  20828. $this->packageName = $packageName;
  20829. $this->license = $license;
  20830. $this->shortDescription = $shortDescription;
  20831. $this->description = $description;
  20832. $this->releases = $releases;
  20833. }
  20834. public function getChannelName()
  20835. {
  20836. return $this->channelName;
  20837. }
  20838. public function getPackageName()
  20839. {
  20840. return $this->packageName;
  20841. }
  20842. public function getDescription()
  20843. {
  20844. return $this->description;
  20845. }
  20846. public function getShortDescription()
  20847. {
  20848. return $this->shortDescription;
  20849. }
  20850. public function getLicense()
  20851. {
  20852. return $this->license;
  20853. }
  20854. public function getReleases()
  20855. {
  20856. return $this->releases;
  20857. }
  20858. }
  20859. <?php
  20860. namespace Composer\Repository\Pear;
  20861. class ReleaseInfo
  20862. {
  20863. private $stability;
  20864. private $dependencyInfo;
  20865. public function __construct($stability, $dependencyInfo)
  20866. {
  20867. $this->stability = $stability;
  20868. $this->dependencyInfo = $dependencyInfo;
  20869. }
  20870. public function getDependencyInfo()
  20871. {
  20872. return $this->dependencyInfo;
  20873. }
  20874. public function getStability()
  20875. {
  20876. return $this->stability;
  20877. }
  20878. }
  20879. <?php
  20880. namespace Composer\Repository;
  20881. use Composer\IO\IOInterface;
  20882. use Composer\Semver\VersionParser as SemverVersionParser;
  20883. use Composer\Package\Version\VersionParser;
  20884. use Composer\Repository\Pear\ChannelReader;
  20885. use Composer\Package\CompletePackage;
  20886. use Composer\Repository\Pear\ChannelInfo;
  20887. use Composer\EventDispatcher\EventDispatcher;
  20888. use Composer\Package\Link;
  20889. use Composer\Semver\Constraint\Constraint;
  20890. use Composer\Util\RemoteFilesystem;
  20891. use Composer\Config;
  20892. use Composer\Factory;
  20893. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20894. {
  20895. private $url;
  20896. private $io;
  20897. private $rfs;
  20898. private $versionParser;
  20899. private $repoConfig;
  20900. private $vendorAlias;
  20901. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  20902. {
  20903. parent::__construct();
  20904. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  20905. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  20906. }
  20907. $urlBits = parse_url($repoConfig['url']);
  20908. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  20909. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  20910. }
  20911. $this->url = rtrim($repoConfig['url'], '/');
  20912. $this->io = $io;
  20913. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  20914. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  20915. $this->versionParser = new VersionParser();
  20916. $this->repoConfig = $repoConfig;
  20917. }
  20918. public function getRepoConfig()
  20919. {
  20920. return $this->repoConfig;
  20921. }
  20922. protected function initialize()
  20923. {
  20924. parent::initialize();
  20925. $this->io->writeError('Initializing PEAR repository '.$this->url);
  20926. $reader = new ChannelReader($this->rfs);
  20927. try {
  20928. $channelInfo = $reader->read($this->url);
  20929. } catch (\Exception $e) {
  20930. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  20931. return;
  20932. }
  20933. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  20934. foreach ($packages as $package) {
  20935. $this->addPackage($package);
  20936. }
  20937. }
  20938. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  20939. {
  20940. $result = array();
  20941. foreach ($channelInfo->getPackages() as $packageDefinition) {
  20942. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  20943. try {
  20944. $normalizedVersion = $versionParser->normalize($version);
  20945. } catch (\UnexpectedValueException $e) {
  20946. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  20947. continue;
  20948. }
  20949. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  20950. $urlBits = parse_url($this->url);
  20951. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  20952. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  20953. $requires = array();
  20954. $suggests = array();
  20955. $conflicts = array();
  20956. $replaces = array();
  20957. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  20958. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  20959. $aliasConstraint = new Constraint('==', $normalizedVersion);
  20960. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  20961. }
  20962. if (!empty($this->vendorAlias)
  20963. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  20964. ) {
  20965. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  20966. $aliasConstraint = new Constraint('==', $normalizedVersion);
  20967. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  20968. }
  20969. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  20970. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  20971. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  20972. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  20973. switch ($dependencyConstraint->getType()) {
  20974. case 'required':
  20975. $requires[] = $link;
  20976. break;
  20977. case 'conflicts':
  20978. $conflicts[] = $link;
  20979. break;
  20980. case 'replaces':
  20981. $replaces[] = $link;
  20982. break;
  20983. }
  20984. }
  20985. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  20986. foreach ($dependencyConstraints as $dependencyConstraint) {
  20987. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  20988. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  20989. }
  20990. }
  20991. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  20992. $package->setType('pear-library');
  20993. $package->setDescription($packageDefinition->getDescription());
  20994. $package->setLicense(array($packageDefinition->getLicense()));
  20995. $package->setDistType('file');
  20996. $package->setDistUrl($distUrl);
  20997. $package->setAutoload(array('classmap' => array('')));
  20998. $package->setIncludePaths(array('/'));
  20999. $package->setRequires($requires);
  21000. $package->setConflicts($conflicts);
  21001. $package->setSuggests($suggests);
  21002. $package->setReplaces($replaces);
  21003. $result[] = $package;
  21004. }
  21005. }
  21006. return $result;
  21007. }
  21008. private function buildComposerPackageName($channelName, $packageName)
  21009. {
  21010. if ('php' === $channelName) {
  21011. return "php";
  21012. }
  21013. if ('ext' === $channelName) {
  21014. return "ext-{$packageName}";
  21015. }
  21016. return "pear-{$channelName}/{$packageName}";
  21017. }
  21018. }
  21019. <?php
  21020. namespace Composer\Repository;
  21021. use Composer\XdebugHandler;
  21022. use Composer\Package\CompletePackage;
  21023. use Composer\Package\PackageInterface;
  21024. use Composer\Package\Version\VersionParser;
  21025. use Composer\Plugin\PluginInterface;
  21026. use Composer\Util\Silencer;
  21027. class PlatformRepository extends ArrayRepository
  21028. {
  21029. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[^/ ]+)$}i';
  21030. private $versionParser;
  21031. private $overrides = array();
  21032. public function __construct(array $packages = array(), array $overrides = array())
  21033. {
  21034. foreach ($overrides as $name => $version) {
  21035. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  21036. }
  21037. parent::__construct($packages);
  21038. }
  21039. protected function initialize()
  21040. {
  21041. parent::initialize();
  21042. $this->versionParser = new VersionParser();
  21043. foreach ($this->overrides as $override) {
  21044. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  21045. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  21046. }
  21047. $this->addOverriddenPackage($override);
  21048. }
  21049. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  21050. $version = $this->versionParser->normalize($prettyVersion);
  21051. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  21052. $composerPluginApi->setDescription('The Composer Plugin API');
  21053. $this->addPackage($composerPluginApi);
  21054. try {
  21055. $prettyVersion = PHP_VERSION;
  21056. $version = $this->versionParser->normalize($prettyVersion);
  21057. } catch (\UnexpectedValueException $e) {
  21058. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  21059. $version = $this->versionParser->normalize($prettyVersion);
  21060. }
  21061. $php = new CompletePackage('php', $version, $prettyVersion);
  21062. $php->setDescription('The PHP interpreter');
  21063. $this->addPackage($php);
  21064. if (PHP_DEBUG) {
  21065. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  21066. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  21067. $this->addPackage($phpdebug);
  21068. }
  21069. if (defined('PHP_ZTS') && PHP_ZTS) {
  21070. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  21071. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  21072. $this->addPackage($phpzts);
  21073. }
  21074. if (PHP_INT_SIZE === 8) {
  21075. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  21076. $php64->setDescription('The PHP interpreter, 64bit');
  21077. $this->addPackage($php64);
  21078. }
  21079. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  21080. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  21081. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  21082. $this->addPackage($phpIpv6);
  21083. }
  21084. $loadedExtensions = get_loaded_extensions();
  21085. foreach ($loadedExtensions as $name) {
  21086. if (in_array($name, array('standard', 'Core'))) {
  21087. continue;
  21088. }
  21089. $reflExt = new \ReflectionExtension($name);
  21090. $prettyVersion = $reflExt->getVersion();
  21091. $this->addExtension($name, $prettyVersion);
  21092. }
  21093. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = strval(getenv(XdebugHandler::ENV_VERSION)))) {
  21094. $this->addExtension('xdebug', $prettyVersion);
  21095. }
  21096. foreach ($loadedExtensions as $name) {
  21097. $prettyVersion = null;
  21098. $description = 'The '.$name.' PHP library';
  21099. switch ($name) {
  21100. case 'curl':
  21101. $curlVersion = curl_version();
  21102. $prettyVersion = $curlVersion['version'];
  21103. break;
  21104. case 'iconv':
  21105. $prettyVersion = ICONV_VERSION;
  21106. break;
  21107. case 'intl':
  21108. $name = 'ICU';
  21109. if (defined('INTL_ICU_VERSION')) {
  21110. $prettyVersion = INTL_ICU_VERSION;
  21111. } else {
  21112. $reflector = new \ReflectionExtension('intl');
  21113. ob_start();
  21114. $reflector->info();
  21115. $output = ob_get_clean();
  21116. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  21117. $prettyVersion = $matches[1];
  21118. }
  21119. break;
  21120. case 'libxml':
  21121. $prettyVersion = LIBXML_DOTTED_VERSION;
  21122. break;
  21123. case 'openssl':
  21124. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  21125. if (empty($match[2])) {
  21126. return $match[1];
  21127. }
  21128. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  21129. return 0;
  21130. }
  21131. $len = strlen($match[2]);
  21132. $patchVersion = ($len - 1) * 26;
  21133. $patchVersion += ord($match[2][$len - 1]) - 96;
  21134. return $match[1].'.'.$patchVersion;
  21135. }, OPENSSL_VERSION_TEXT);
  21136. $description = OPENSSL_VERSION_TEXT;
  21137. break;
  21138. case 'pcre':
  21139. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  21140. break;
  21141. case 'uuid':
  21142. $prettyVersion = phpversion('uuid');
  21143. break;
  21144. case 'xsl':
  21145. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  21146. break;
  21147. default:
  21148. continue 2;
  21149. }
  21150. try {
  21151. $version = $this->versionParser->normalize($prettyVersion);
  21152. } catch (\UnexpectedValueException $e) {
  21153. continue;
  21154. }
  21155. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  21156. $lib->setDescription($description);
  21157. $this->addPackage($lib);
  21158. }
  21159. if (defined('HHVM_VERSION')) {
  21160. try {
  21161. $prettyVersion = HHVM_VERSION;
  21162. $version = $this->versionParser->normalize($prettyVersion);
  21163. } catch (\UnexpectedValueException $e) {
  21164. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', HHVM_VERSION);
  21165. $version = $this->versionParser->normalize($prettyVersion);
  21166. }
  21167. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  21168. $hhvm->setDescription('The HHVM Runtime (64bit)');
  21169. $this->addPackage($hhvm);
  21170. }
  21171. }
  21172. public function addPackage(PackageInterface $package)
  21173. {
  21174. if (isset($this->overrides[$package->getName()])) {
  21175. $overrider = $this->findPackage($package->getName(), '*');
  21176. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  21177. return;
  21178. }
  21179. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  21180. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  21181. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  21182. return;
  21183. }
  21184. parent::addPackage($package);
  21185. }
  21186. private function addOverriddenPackage(array $override, $name = null)
  21187. {
  21188. $version = $this->versionParser->normalize($override['version']);
  21189. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  21190. $package->setDescription('Package overridden via config.platform');
  21191. $package->setExtra(array('config.platform' => true));
  21192. parent::addPackage($package);
  21193. return $package;
  21194. }
  21195. private function addExtension($name, $prettyVersion)
  21196. {
  21197. $extraDescription = null;
  21198. try {
  21199. $version = $this->versionParser->normalize($prettyVersion);
  21200. } catch (\UnexpectedValueException $e) {
  21201. $extraDescription = ' (actual version: '.$prettyVersion.')';
  21202. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  21203. $prettyVersion = $match[1];
  21204. } else {
  21205. $prettyVersion = '0';
  21206. }
  21207. $version = $this->versionParser->normalize($prettyVersion);
  21208. }
  21209. $packageName = $this->buildPackageName($name);
  21210. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  21211. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  21212. $this->addPackage($ext);
  21213. }
  21214. private function buildPackageName($name)
  21215. {
  21216. return 'ext-' . str_replace(' ', '-', $name);
  21217. }
  21218. }
  21219. <?php
  21220. namespace Composer\Repository;
  21221. use Composer\Factory;
  21222. use Composer\IO\IOInterface;
  21223. use Composer\Config;
  21224. use Composer\EventDispatcher\EventDispatcher;
  21225. use Composer\Util\RemoteFilesystem;
  21226. use Composer\Json\JsonFile;
  21227. class RepositoryFactory
  21228. {
  21229. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  21230. {
  21231. if (0 === strpos($repository, 'http')) {
  21232. $repoConfig = array('type' => 'composer', 'url' => $repository);
  21233. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  21234. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  21235. $data = $json->read();
  21236. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  21237. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  21238. } elseif ($allowFilesystem) {
  21239. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  21240. } else {
  21241. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  21242. }
  21243. } elseif ('{' === substr($repository, 0, 1)) {
  21244. $repoConfig = JsonFile::parseJson($repository);
  21245. } else {
  21246. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  21247. }
  21248. return $repoConfig;
  21249. }
  21250. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  21251. {
  21252. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  21253. return static::createRepo($io, $config, $repoConfig);
  21254. }
  21255. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  21256. {
  21257. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  21258. $repos = static::createRepos($rm, array($repoConfig));
  21259. return reset($repos);
  21260. }
  21261. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  21262. {
  21263. if (!$config) {
  21264. $config = Factory::createConfig($io);
  21265. }
  21266. if (!$rm) {
  21267. if (!$io) {
  21268. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  21269. }
  21270. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  21271. }
  21272. return static::createRepos($rm, $config->getRepositories());
  21273. }
  21274. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21275. {
  21276. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  21277. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  21278. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  21279. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  21280. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  21281. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  21282. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  21283. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  21284. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  21285. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  21286. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  21287. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  21288. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  21289. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  21290. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  21291. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  21292. return $rm;
  21293. }
  21294. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  21295. {
  21296. $repos = array();
  21297. foreach ($repoConfigs as $index => $repo) {
  21298. if (is_string($repo)) {
  21299. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  21300. }
  21301. if (!is_array($repo)) {
  21302. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  21303. }
  21304. if (!isset($repo['type'])) {
  21305. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  21306. }
  21307. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  21308. while (isset($repos[$name])) {
  21309. $name .= '2';
  21310. }
  21311. if ($repo['type'] === 'filesystem') {
  21312. $repos[$name] = new FilesystemRepository($repo['json']);
  21313. } else {
  21314. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  21315. }
  21316. }
  21317. return $repos;
  21318. }
  21319. }
  21320. <?php
  21321. namespace Composer\Repository;
  21322. use Composer\Package\PackageInterface;
  21323. interface RepositoryInterface extends \Countable
  21324. {
  21325. const SEARCH_FULLTEXT = 0;
  21326. const SEARCH_NAME = 1;
  21327. public function hasPackage(PackageInterface $package);
  21328. public function findPackage($name, $constraint);
  21329. public function findPackages($name, $constraint = null);
  21330. public function getPackages();
  21331. public function search($query, $mode = 0);
  21332. }
  21333. <?php
  21334. namespace Composer\Repository;
  21335. use Composer\IO\IOInterface;
  21336. use Composer\Config;
  21337. use Composer\EventDispatcher\EventDispatcher;
  21338. use Composer\Package\PackageInterface;
  21339. use Composer\Util\RemoteFilesystem;
  21340. class RepositoryManager
  21341. {
  21342. private $localRepository;
  21343. private $repositories = array();
  21344. private $repositoryClasses = array();
  21345. private $io;
  21346. private $config;
  21347. private $eventDispatcher;
  21348. private $rfs;
  21349. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21350. {
  21351. $this->io = $io;
  21352. $this->config = $config;
  21353. $this->eventDispatcher = $eventDispatcher;
  21354. $this->rfs = $rfs;
  21355. }
  21356. public function findPackage($name, $constraint)
  21357. {
  21358. foreach ($this->repositories as $repository) {
  21359. if ($package = $repository->findPackage($name, $constraint)) {
  21360. return $package;
  21361. }
  21362. }
  21363. return null;
  21364. }
  21365. public function findPackages($name, $constraint)
  21366. {
  21367. $packages = array();
  21368. foreach ($this->repositories as $repository) {
  21369. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  21370. }
  21371. return $packages;
  21372. }
  21373. public function addRepository(RepositoryInterface $repository)
  21374. {
  21375. $this->repositories[] = $repository;
  21376. }
  21377. public function prependRepository(RepositoryInterface $repository)
  21378. {
  21379. array_unshift($this->repositories, $repository);
  21380. }
  21381. public function createRepository($type, $config, $name = null)
  21382. {
  21383. if (!isset($this->repositoryClasses[$type])) {
  21384. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  21385. }
  21386. if (isset($config['packagist']) && false === $config['packagist']) {
  21387. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  21388. }
  21389. $class = $this->repositoryClasses[$type];
  21390. $reflMethod = new \ReflectionMethod($class, '__construct');
  21391. $params = $reflMethod->getParameters();
  21392. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  21393. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  21394. }
  21395. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  21396. }
  21397. public function setRepositoryClass($type, $class)
  21398. {
  21399. $this->repositoryClasses[$type] = $class;
  21400. }
  21401. public function getRepositories()
  21402. {
  21403. return $this->repositories;
  21404. }
  21405. public function setLocalRepository(WritableRepositoryInterface $repository)
  21406. {
  21407. $this->localRepository = $repository;
  21408. }
  21409. public function getLocalRepository()
  21410. {
  21411. return $this->localRepository;
  21412. }
  21413. }
  21414. <?php
  21415. namespace Composer\Repository;
  21416. class RepositorySecurityException extends \Exception
  21417. {
  21418. }
  21419. <?php
  21420. namespace Composer\Repository\Vcs;
  21421. use Composer\Cache;
  21422. use Composer\Downloader\TransportException;
  21423. use Composer\Json\JsonFile;
  21424. use Composer\Util\Bitbucket;
  21425. abstract class BitbucketDriver extends VcsDriver
  21426. {
  21427. protected $cache;
  21428. protected $owner;
  21429. protected $repository;
  21430. protected $hasIssues;
  21431. protected $rootIdentifier;
  21432. protected $tags;
  21433. protected $branches;
  21434. protected $infoCache = array();
  21435. protected $branchesUrl = '';
  21436. protected $tagsUrl = '';
  21437. protected $homeUrl = '';
  21438. protected $website = '';
  21439. protected $cloneHttpsUrl = '';
  21440. protected $fallbackDriver;
  21441. protected $vcsType;
  21442. public function initialize()
  21443. {
  21444. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#', $this->url, $match);
  21445. $this->owner = $match[1];
  21446. $this->repository = $match[2];
  21447. $this->originUrl = 'bitbucket.org';
  21448. $this->cache = new Cache(
  21449. $this->io,
  21450. implode('/', array(
  21451. $this->config->get('cache-repo-dir'),
  21452. $this->originUrl,
  21453. $this->owner,
  21454. $this->repository,
  21455. ))
  21456. );
  21457. }
  21458. public function getUrl()
  21459. {
  21460. if ($this->fallbackDriver) {
  21461. return $this->fallbackDriver->getUrl();
  21462. }
  21463. return $this->cloneHttpsUrl;
  21464. }
  21465. protected function getRepoData()
  21466. {
  21467. $resource = sprintf(
  21468. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  21469. $this->owner,
  21470. $this->repository,
  21471. http_build_query(
  21472. array('fields' => '-project,-owner'),
  21473. null,
  21474. '&'
  21475. )
  21476. );
  21477. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  21478. if ($this->fallbackDriver) {
  21479. return false;
  21480. }
  21481. $this->parseCloneUrls($repoData['links']['clone']);
  21482. $this->hasIssues = !empty($repoData['has_issues']);
  21483. $this->branchesUrl = $repoData['links']['branches']['href'];
  21484. $this->tagsUrl = $repoData['links']['tags']['href'];
  21485. $this->homeUrl = $repoData['links']['html']['href'];
  21486. $this->website = $repoData['website'];
  21487. $this->vcsType = $repoData['scm'];
  21488. return true;
  21489. }
  21490. public function getComposerInformation($identifier)
  21491. {
  21492. if ($this->fallbackDriver) {
  21493. return $this->fallbackDriver->getComposerInformation($identifier);
  21494. }
  21495. if (!isset($this->infoCache[$identifier])) {
  21496. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  21497. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  21498. }
  21499. $composer = $this->getBaseComposerInformation($identifier);
  21500. if (!isset($composer['support']['source'])) {
  21501. $label = array_search(
  21502. $identifier,
  21503. $this->getTags()
  21504. ) ?: array_search(
  21505. $identifier,
  21506. $this->getBranches()
  21507. ) ?: $identifier;
  21508. if (array_key_exists($label, $tags = $this->getTags())) {
  21509. $hash = $tags[$label];
  21510. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  21511. $hash = $branches[$label];
  21512. }
  21513. if (! isset($hash)) {
  21514. $composer['support']['source'] = sprintf(
  21515. 'https://%s/%s/%s/src',
  21516. $this->originUrl,
  21517. $this->owner,
  21518. $this->repository
  21519. );
  21520. } else {
  21521. $composer['support']['source'] = sprintf(
  21522. 'https://%s/%s/%s/src/%s/?at=%s',
  21523. $this->originUrl,
  21524. $this->owner,
  21525. $this->repository,
  21526. $hash,
  21527. $label
  21528. );
  21529. }
  21530. }
  21531. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  21532. $composer['support']['issues'] = sprintf(
  21533. 'https://%s/%s/%s/issues',
  21534. $this->originUrl,
  21535. $this->owner,
  21536. $this->repository
  21537. );
  21538. }
  21539. if (!isset($composer['homepage'])) {
  21540. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  21541. }
  21542. $this->infoCache[$identifier] = $composer;
  21543. if ($this->shouldCache($identifier)) {
  21544. $this->cache->write($identifier, json_encode($composer));
  21545. }
  21546. }
  21547. return $this->infoCache[$identifier];
  21548. }
  21549. public function getFileContent($file, $identifier)
  21550. {
  21551. if ($this->fallbackDriver) {
  21552. return $this->fallbackDriver->getFileContent($file, $identifier);
  21553. }
  21554. $resource = sprintf(
  21555. 'https://api.bitbucket.org/1.0/repositories/%s/%s/raw/%s/%s',
  21556. $this->owner,
  21557. $this->repository,
  21558. $identifier,
  21559. $file
  21560. );
  21561. return $this->getContentsWithOAuthCredentials($resource);
  21562. }
  21563. public function getChangeDate($identifier)
  21564. {
  21565. if ($this->fallbackDriver) {
  21566. return $this->fallbackDriver->getChangeDate($identifier);
  21567. }
  21568. $resource = sprintf(
  21569. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  21570. $this->owner,
  21571. $this->repository,
  21572. $identifier
  21573. );
  21574. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21575. return new \DateTime($commit['date']);
  21576. }
  21577. public function getSource($identifier)
  21578. {
  21579. if ($this->fallbackDriver) {
  21580. return $this->fallbackDriver->getSource($identifier);
  21581. }
  21582. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  21583. }
  21584. public function getDist($identifier)
  21585. {
  21586. if ($this->fallbackDriver) {
  21587. return $this->fallbackDriver->getDist($identifier);
  21588. }
  21589. $url = sprintf(
  21590. 'https://bitbucket.org/%s/%s/get/%s.zip',
  21591. $this->owner,
  21592. $this->repository,
  21593. $identifier
  21594. );
  21595. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  21596. }
  21597. public function getTags()
  21598. {
  21599. if ($this->fallbackDriver) {
  21600. return $this->fallbackDriver->getTags();
  21601. }
  21602. if (null === $this->tags) {
  21603. $this->tags = array();
  21604. $resource = sprintf(
  21605. '%s?%s',
  21606. $this->tagsUrl,
  21607. http_build_query(
  21608. array(
  21609. 'pagelen' => 100,
  21610. 'fields' => 'values.name,values.target.hash,next',
  21611. 'sort' => '-target.date',
  21612. ),
  21613. null,
  21614. '&'
  21615. )
  21616. );
  21617. $hasNext = true;
  21618. while ($hasNext) {
  21619. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21620. foreach ($tagsData['values'] as $data) {
  21621. $this->tags[$data['name']] = $data['target']['hash'];
  21622. }
  21623. if (empty($tagsData['next'])) {
  21624. $hasNext = false;
  21625. } else {
  21626. $resource = $tagsData['next'];
  21627. }
  21628. }
  21629. if ($this->vcsType === 'hg') {
  21630. unset($this->tags['tip']);
  21631. }
  21632. }
  21633. return $this->tags;
  21634. }
  21635. public function getBranches()
  21636. {
  21637. if ($this->fallbackDriver) {
  21638. return $this->fallbackDriver->getBranches();
  21639. }
  21640. if (null === $this->branches) {
  21641. $this->branches = array();
  21642. $resource = sprintf(
  21643. '%s?%s',
  21644. $this->branchesUrl,
  21645. http_build_query(
  21646. array(
  21647. 'pagelen' => 100,
  21648. 'fields' => 'values.name,values.target.hash,values.heads,next',
  21649. 'sort' => '-target.date',
  21650. ),
  21651. null,
  21652. '&'
  21653. )
  21654. );
  21655. $hasNext = true;
  21656. while ($hasNext) {
  21657. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21658. foreach ($branchData['values'] as $data) {
  21659. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  21660. continue;
  21661. }
  21662. $this->branches[$data['name']] = $data['target']['hash'];
  21663. }
  21664. if (empty($branchData['next'])) {
  21665. $hasNext = false;
  21666. } else {
  21667. $resource = $branchData['next'];
  21668. }
  21669. }
  21670. }
  21671. return $this->branches;
  21672. }
  21673. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  21674. {
  21675. try {
  21676. return parent::getContents($url);
  21677. } catch (TransportException $e) {
  21678. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  21679. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  21680. if (!$this->io->hasAuthentication($this->originUrl)
  21681. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  21682. ) {
  21683. return parent::getContents($url);
  21684. }
  21685. if (!$this->io->isInteractive() && $fetchingRepoData) {
  21686. return $this->attemptCloneFallback();
  21687. }
  21688. }
  21689. throw $e;
  21690. }
  21691. }
  21692. abstract protected function generateSshUrl();
  21693. protected function attemptCloneFallback()
  21694. {
  21695. try {
  21696. $this->setupFallbackDriver($this->generateSshUrl());
  21697. } catch (\RuntimeException $e) {
  21698. $this->fallbackDriver = null;
  21699. $this->io->writeError(
  21700. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  21701. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  21702. );
  21703. throw $e;
  21704. }
  21705. }
  21706. abstract protected function setupFallbackDriver($url);
  21707. protected function parseCloneUrls(array $cloneLinks)
  21708. {
  21709. foreach ($cloneLinks as $cloneLink) {
  21710. if ($cloneLink['name'] === 'https') {
  21711. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  21712. }
  21713. }
  21714. }
  21715. protected function getMainBranchData()
  21716. {
  21717. $resource = sprintf(
  21718. 'https://api.bitbucket.org/1.0/repositories/%s/%s/main-branch',
  21719. $this->owner,
  21720. $this->repository
  21721. );
  21722. return JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21723. }
  21724. }
  21725. <?php
  21726. namespace Composer\Repository\Vcs;
  21727. use Composer\Config;
  21728. use Composer\Util\ProcessExecutor;
  21729. use Composer\Util\Filesystem;
  21730. use Composer\IO\IOInterface;
  21731. class FossilDriver extends VcsDriver
  21732. {
  21733. protected $tags;
  21734. protected $branches;
  21735. protected $rootIdentifier;
  21736. protected $repoFile;
  21737. protected $checkoutDir;
  21738. protected $infoCache = array();
  21739. public function initialize()
  21740. {
  21741. $this->checkFossil();
  21742. $this->config->prohibitUrlByConfig($this->url, $this->io);
  21743. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  21744. $this->checkoutDir = $this->url;
  21745. } else {
  21746. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  21747. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  21748. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  21749. $this->updateLocalRepo();
  21750. }
  21751. $this->getTags();
  21752. $this->getBranches();
  21753. }
  21754. protected function checkFossil()
  21755. {
  21756. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  21757. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  21758. }
  21759. }
  21760. protected function updateLocalRepo()
  21761. {
  21762. $fs = new Filesystem();
  21763. $fs->ensureDirectoryExists($this->checkoutDir);
  21764. if (!is_writable(dirname($this->checkoutDir))) {
  21765. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  21766. }
  21767. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  21768. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  21769. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  21770. }
  21771. } else {
  21772. $fs->removeDirectory($this->checkoutDir);
  21773. $fs->remove($this->repoFile);
  21774. $fs->ensureDirectoryExists($this->checkoutDir);
  21775. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  21776. $output = $this->process->getErrorOutput();
  21777. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  21778. }
  21779. if (0 !== $this->process->execute(sprintf('fossil open %s', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  21780. $output = $this->process->getErrorOutput();
  21781. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  21782. }
  21783. }
  21784. }
  21785. public function getRootIdentifier()
  21786. {
  21787. if (null === $this->rootIdentifier) {
  21788. $this->rootIdentifier = 'trunk';
  21789. }
  21790. return $this->rootIdentifier;
  21791. }
  21792. public function getUrl()
  21793. {
  21794. return $this->url;
  21795. }
  21796. public function getSource($identifier)
  21797. {
  21798. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  21799. }
  21800. public function getDist($identifier)
  21801. {
  21802. return null;
  21803. }
  21804. public function getFileContent($file, $identifier)
  21805. {
  21806. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  21807. $this->process->execute($command, $content, $this->checkoutDir);
  21808. if (!trim($content)) {
  21809. return null;
  21810. }
  21811. return $content;
  21812. }
  21813. public function getChangeDate($identifier)
  21814. {
  21815. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  21816. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  21817. return new \DateTime($date, new \DateTimeZone('UTC'));
  21818. }
  21819. public function getTags()
  21820. {
  21821. if (null === $this->tags) {
  21822. $tags = array();
  21823. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  21824. foreach ($this->process->splitLines($output) as $tag) {
  21825. $tags[$tag] = $tag;
  21826. }
  21827. $this->tags = $tags;
  21828. }
  21829. return $this->tags;
  21830. }
  21831. public function getBranches()
  21832. {
  21833. if (null === $this->branches) {
  21834. $branches = array();
  21835. $bookmarks = array();
  21836. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  21837. foreach ($this->process->splitLines($output) as $branch) {
  21838. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  21839. $branches[$branch] = $branch;
  21840. }
  21841. $this->branches = $branches;
  21842. }
  21843. return $this->branches;
  21844. }
  21845. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21846. {
  21847. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  21848. return true;
  21849. }
  21850. if (preg_match('!/fossil/|\.fossil!', $url)) {
  21851. return true;
  21852. }
  21853. if (Filesystem::isLocalPath($url)) {
  21854. $url = Filesystem::getPlatformPath($url);
  21855. if (!is_dir($url)) {
  21856. return false;
  21857. }
  21858. $process = new ProcessExecutor();
  21859. if ($process->execute('fossil info', $output, $url) === 0) {
  21860. return true;
  21861. }
  21862. }
  21863. return false;
  21864. }
  21865. }
  21866. <?php
  21867. namespace Composer\Repository\Vcs;
  21868. use Composer\Config;
  21869. use Composer\IO\IOInterface;
  21870. class GitBitbucketDriver extends BitbucketDriver
  21871. {
  21872. public function getRootIdentifier()
  21873. {
  21874. if ($this->fallbackDriver) {
  21875. return $this->fallbackDriver->getRootIdentifier();
  21876. }
  21877. if (null === $this->rootIdentifier) {
  21878. if (! $this->getRepoData()) {
  21879. return $this->fallbackDriver->getRootIdentifier();
  21880. }
  21881. if ($this->vcsType !== 'git') {
  21882. throw new \RuntimeException(
  21883. $this->url.' does not appear to be a git repository, use '.
  21884. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  21885. );
  21886. }
  21887. $mainBranchData = $this->getMainBranchData();
  21888. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  21889. }
  21890. return $this->rootIdentifier;
  21891. }
  21892. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21893. {
  21894. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
  21895. return false;
  21896. }
  21897. if (!extension_loaded('openssl')) {
  21898. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  21899. return false;
  21900. }
  21901. return true;
  21902. }
  21903. protected function setupFallbackDriver($url)
  21904. {
  21905. $this->fallbackDriver = new GitDriver(
  21906. array('url' => $url),
  21907. $this->io,
  21908. $this->config,
  21909. $this->process,
  21910. $this->remoteFilesystem
  21911. );
  21912. $this->fallbackDriver->initialize();
  21913. }
  21914. protected function generateSshUrl()
  21915. {
  21916. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  21917. }
  21918. }
  21919. <?php
  21920. namespace Composer\Repository\Vcs;
  21921. use Composer\Util\ProcessExecutor;
  21922. use Composer\Util\Filesystem;
  21923. use Composer\Util\Git as GitUtil;
  21924. use Composer\IO\IOInterface;
  21925. use Composer\Cache;
  21926. use Composer\Config;
  21927. class GitDriver extends VcsDriver
  21928. {
  21929. protected $cache;
  21930. protected $tags;
  21931. protected $branches;
  21932. protected $rootIdentifier;
  21933. protected $repoDir;
  21934. protected $infoCache = array();
  21935. public function initialize()
  21936. {
  21937. if (Filesystem::isLocalPath($this->url)) {
  21938. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  21939. $this->repoDir = $this->url;
  21940. $cacheUrl = realpath($this->url);
  21941. } else {
  21942. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  21943. GitUtil::cleanEnv();
  21944. $fs = new Filesystem();
  21945. $fs->ensureDirectoryExists(dirname($this->repoDir));
  21946. if (!is_writable(dirname($this->repoDir))) {
  21947. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  21948. }
  21949. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  21950. 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.');
  21951. }
  21952. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  21953. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  21954. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  21955. }
  21956. $cacheUrl = $this->url;
  21957. }
  21958. $this->getTags();
  21959. $this->getBranches();
  21960. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  21961. }
  21962. public function getRootIdentifier()
  21963. {
  21964. if (null === $this->rootIdentifier) {
  21965. $this->rootIdentifier = 'master';
  21966. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  21967. $branches = $this->process->splitLines($output);
  21968. if (!in_array('* master', $branches)) {
  21969. foreach ($branches as $branch) {
  21970. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  21971. $this->rootIdentifier = $match[1];
  21972. break;
  21973. }
  21974. }
  21975. }
  21976. }
  21977. return $this->rootIdentifier;
  21978. }
  21979. public function getUrl()
  21980. {
  21981. return $this->url;
  21982. }
  21983. public function getSource($identifier)
  21984. {
  21985. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  21986. }
  21987. public function getDist($identifier)
  21988. {
  21989. return null;
  21990. }
  21991. public function getFileContent($file, $identifier)
  21992. {
  21993. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  21994. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  21995. if (!trim($content)) {
  21996. return null;
  21997. }
  21998. return $content;
  21999. }
  22000. public function getChangeDate($identifier)
  22001. {
  22002. $this->process->execute(sprintf(
  22003. 'git log -1 --format=%%at %s',
  22004. ProcessExecutor::escape($identifier)
  22005. ), $output, $this->repoDir);
  22006. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  22007. }
  22008. public function getTags()
  22009. {
  22010. if (null === $this->tags) {
  22011. $this->tags = array();
  22012. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  22013. foreach ($output = $this->process->splitLines($output) as $tag) {
  22014. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  22015. $this->tags[$match[2]] = $match[1];
  22016. }
  22017. }
  22018. }
  22019. return $this->tags;
  22020. }
  22021. public function getBranches()
  22022. {
  22023. if (null === $this->branches) {
  22024. $branches = array();
  22025. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  22026. foreach ($this->process->splitLines($output) as $branch) {
  22027. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  22028. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  22029. $branches[$match[1]] = $match[2];
  22030. }
  22031. }
  22032. }
  22033. $this->branches = $branches;
  22034. }
  22035. return $this->branches;
  22036. }
  22037. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22038. {
  22039. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  22040. return true;
  22041. }
  22042. if (Filesystem::isLocalPath($url)) {
  22043. $url = Filesystem::getPlatformPath($url);
  22044. if (!is_dir($url)) {
  22045. return false;
  22046. }
  22047. $process = new ProcessExecutor($io);
  22048. if ($process->execute('git tag', $output, $url) === 0) {
  22049. return true;
  22050. }
  22051. }
  22052. if (!$deep) {
  22053. return false;
  22054. }
  22055. $process = new ProcessExecutor($io);
  22056. return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
  22057. }
  22058. }
  22059. <?php
  22060. namespace Composer\Repository\Vcs;
  22061. use Composer\Config;
  22062. use Composer\Downloader\TransportException;
  22063. use Composer\Json\JsonFile;
  22064. use Composer\Cache;
  22065. use Composer\IO\IOInterface;
  22066. use Composer\Util\GitHub;
  22067. class GitHubDriver extends VcsDriver
  22068. {
  22069. protected $cache;
  22070. protected $owner;
  22071. protected $repository;
  22072. protected $tags;
  22073. protected $branches;
  22074. protected $rootIdentifier;
  22075. protected $repoData;
  22076. protected $hasIssues;
  22077. protected $infoCache = array();
  22078. protected $isPrivate = false;
  22079. protected $gitDriver;
  22080. public function initialize()
  22081. {
  22082. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  22083. $this->owner = $match[3];
  22084. $this->repository = $match[4];
  22085. $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
  22086. if ($this->originUrl === 'www.github.com') {
  22087. $this->originUrl = 'github.com';
  22088. }
  22089. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  22090. if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
  22091. $this->setupGitDriver($this->url);
  22092. return;
  22093. }
  22094. $this->fetchRootIdentifier();
  22095. }
  22096. public function getRepositoryUrl()
  22097. {
  22098. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  22099. }
  22100. public function getRootIdentifier()
  22101. {
  22102. if ($this->gitDriver) {
  22103. return $this->gitDriver->getRootIdentifier();
  22104. }
  22105. return $this->rootIdentifier;
  22106. }
  22107. public function getUrl()
  22108. {
  22109. if ($this->gitDriver) {
  22110. return $this->gitDriver->getUrl();
  22111. }
  22112. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  22113. }
  22114. protected function getApiUrl()
  22115. {
  22116. if ('github.com' === $this->originUrl) {
  22117. $apiUrl = 'api.github.com';
  22118. } else {
  22119. $apiUrl = $this->originUrl . '/api/v3';
  22120. }
  22121. return 'https://' . $apiUrl;
  22122. }
  22123. public function getSource($identifier)
  22124. {
  22125. if ($this->gitDriver) {
  22126. return $this->gitDriver->getSource($identifier);
  22127. }
  22128. if ($this->isPrivate) {
  22129. $url = $this->generateSshUrl();
  22130. } else {
  22131. $url = $this->getUrl();
  22132. }
  22133. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  22134. }
  22135. public function getDist($identifier)
  22136. {
  22137. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  22138. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22139. }
  22140. public function getComposerInformation($identifier)
  22141. {
  22142. if ($this->gitDriver) {
  22143. return $this->gitDriver->getComposerInformation($identifier);
  22144. }
  22145. if (!isset($this->infoCache[$identifier])) {
  22146. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22147. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22148. }
  22149. $composer = $this->getBaseComposerInformation($identifier);
  22150. if ($composer) {
  22151. if (!isset($composer['support']['source'])) {
  22152. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  22153. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  22154. }
  22155. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22156. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  22157. }
  22158. }
  22159. if ($this->shouldCache($identifier)) {
  22160. $this->cache->write($identifier, json_encode($composer));
  22161. }
  22162. $this->infoCache[$identifier] = $composer;
  22163. }
  22164. return $this->infoCache[$identifier];
  22165. }
  22166. public function getFileContent($file, $identifier)
  22167. {
  22168. if ($this->gitDriver) {
  22169. return $this->gitDriver->getFileContent($file, $identifier);
  22170. }
  22171. $notFoundRetries = 2;
  22172. while ($notFoundRetries) {
  22173. try {
  22174. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  22175. $resource = JsonFile::parseJson($this->getContents($resource));
  22176. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  22177. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  22178. }
  22179. return $content;
  22180. } catch (TransportException $e) {
  22181. if (404 !== $e->getCode()) {
  22182. throw $e;
  22183. }
  22184. $notFoundRetries--;
  22185. return null;
  22186. }
  22187. }
  22188. return null;
  22189. }
  22190. public function getChangeDate($identifier)
  22191. {
  22192. if ($this->gitDriver) {
  22193. return $this->gitDriver->getChangeDate($identifier);
  22194. }
  22195. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  22196. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  22197. return new \DateTime($commit['commit']['committer']['date']);
  22198. }
  22199. public function getTags()
  22200. {
  22201. if ($this->gitDriver) {
  22202. return $this->gitDriver->getTags();
  22203. }
  22204. if (null === $this->tags) {
  22205. $this->tags = array();
  22206. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  22207. do {
  22208. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  22209. foreach ($tagsData as $tag) {
  22210. $this->tags[$tag['name']] = $tag['commit']['sha'];
  22211. }
  22212. $resource = $this->getNextPage();
  22213. } while ($resource);
  22214. }
  22215. return $this->tags;
  22216. }
  22217. public function getBranches()
  22218. {
  22219. if ($this->gitDriver) {
  22220. return $this->gitDriver->getBranches();
  22221. }
  22222. if (null === $this->branches) {
  22223. $this->branches = array();
  22224. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  22225. $branchBlacklist = array('gh-pages');
  22226. do {
  22227. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  22228. foreach ($branchData as $branch) {
  22229. $name = substr($branch['ref'], 11);
  22230. if (!in_array($name, $branchBlacklist)) {
  22231. $this->branches[$name] = $branch['object']['sha'];
  22232. }
  22233. }
  22234. $resource = $this->getNextPage();
  22235. } while ($resource);
  22236. }
  22237. return $this->branches;
  22238. }
  22239. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22240. {
  22241. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  22242. return false;
  22243. }
  22244. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  22245. if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
  22246. return false;
  22247. }
  22248. if (!extension_loaded('openssl')) {
  22249. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22250. return false;
  22251. }
  22252. return true;
  22253. }
  22254. public function getRepoData()
  22255. {
  22256. $this->fetchRootIdentifier();
  22257. return $this->repoData;
  22258. }
  22259. protected function generateSshUrl()
  22260. {
  22261. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  22262. }
  22263. protected function getContents($url, $fetchingRepoData = false)
  22264. {
  22265. try {
  22266. return parent::getContents($url);
  22267. } catch (TransportException $e) {
  22268. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22269. switch ($e->getCode()) {
  22270. case 401:
  22271. case 404:
  22272. if (!$fetchingRepoData) {
  22273. throw $e;
  22274. }
  22275. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  22276. return parent::getContents($url);
  22277. }
  22278. if (!$this->io->isInteractive()) {
  22279. return $this->attemptCloneFallback();
  22280. }
  22281. $scopesIssued = array();
  22282. $scopesNeeded = array();
  22283. if ($headers = $e->getHeaders()) {
  22284. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  22285. $scopesIssued = explode(' ', $scopes);
  22286. }
  22287. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  22288. $scopesNeeded = explode(' ', $scopes);
  22289. }
  22290. }
  22291. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  22292. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  22293. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  22294. }
  22295. return parent::getContents($url);
  22296. case 403:
  22297. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  22298. return parent::getContents($url);
  22299. }
  22300. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22301. return $this->attemptCloneFallback();
  22302. }
  22303. $rateLimited = false;
  22304. foreach ($e->getHeaders() as $header) {
  22305. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  22306. $rateLimited = true;
  22307. }
  22308. }
  22309. if (!$this->io->hasAuthentication($this->originUrl)) {
  22310. if (!$this->io->isInteractive()) {
  22311. $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>');
  22312. throw $e;
  22313. }
  22314. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  22315. return parent::getContents($url);
  22316. }
  22317. if ($rateLimited) {
  22318. $rateLimit = $this->getRateLimit($e->getHeaders());
  22319. $this->io->writeError(sprintf(
  22320. '<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>',
  22321. $rateLimit['limit'],
  22322. $rateLimit['reset']
  22323. ));
  22324. }
  22325. throw $e;
  22326. default:
  22327. throw $e;
  22328. }
  22329. }
  22330. }
  22331. protected function getRateLimit(array $headers)
  22332. {
  22333. $rateLimit = array(
  22334. 'limit' => '?',
  22335. 'reset' => '?',
  22336. );
  22337. foreach ($headers as $header) {
  22338. $header = trim($header);
  22339. if (false === strpos($header, 'X-RateLimit-')) {
  22340. continue;
  22341. }
  22342. list($type, $value) = explode(':', $header, 2);
  22343. switch ($type) {
  22344. case 'X-RateLimit-Limit':
  22345. $rateLimit['limit'] = (int) trim($value);
  22346. break;
  22347. case 'X-RateLimit-Reset':
  22348. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  22349. break;
  22350. }
  22351. }
  22352. return $rateLimit;
  22353. }
  22354. protected function fetchRootIdentifier()
  22355. {
  22356. if ($this->repoData) {
  22357. return;
  22358. }
  22359. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  22360. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  22361. if (null === $this->repoData && null !== $this->gitDriver) {
  22362. return;
  22363. }
  22364. $this->owner = $this->repoData['owner']['login'];
  22365. $this->repository = $this->repoData['name'];
  22366. $this->isPrivate = !empty($this->repoData['private']);
  22367. if (isset($this->repoData['default_branch'])) {
  22368. $this->rootIdentifier = $this->repoData['default_branch'];
  22369. } elseif (isset($this->repoData['master_branch'])) {
  22370. $this->rootIdentifier = $this->repoData['master_branch'];
  22371. } else {
  22372. $this->rootIdentifier = 'master';
  22373. }
  22374. $this->hasIssues = !empty($this->repoData['has_issues']);
  22375. }
  22376. protected function attemptCloneFallback()
  22377. {
  22378. $this->isPrivate = true;
  22379. try {
  22380. $this->setupGitDriver($this->generateSshUrl());
  22381. return;
  22382. } catch (\RuntimeException $e) {
  22383. $this->gitDriver = null;
  22384. $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>');
  22385. throw $e;
  22386. }
  22387. }
  22388. protected function setupGitDriver($url)
  22389. {
  22390. $this->gitDriver = new GitDriver(
  22391. array('url' => $url),
  22392. $this->io,
  22393. $this->config,
  22394. $this->process,
  22395. $this->remoteFilesystem
  22396. );
  22397. $this->gitDriver->initialize();
  22398. }
  22399. protected function getNextPage()
  22400. {
  22401. $headers = $this->remoteFilesystem->getLastHeaders();
  22402. foreach ($headers as $header) {
  22403. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  22404. $links = explode(',', $match[1]);
  22405. foreach ($links as $link) {
  22406. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  22407. return $match[1];
  22408. }
  22409. }
  22410. }
  22411. }
  22412. }
  22413. }
  22414. <?php
  22415. namespace Composer\Repository\Vcs;
  22416. use Composer\Config;
  22417. use Composer\Cache;
  22418. use Composer\IO\IOInterface;
  22419. use Composer\Json\JsonFile;
  22420. use Composer\Downloader\TransportException;
  22421. use Composer\Util\RemoteFilesystem;
  22422. use Composer\Util\GitLab;
  22423. class GitLabDriver extends VcsDriver
  22424. {
  22425. private $scheme;
  22426. private $namespace;
  22427. private $repository;
  22428. private $project;
  22429. private $commits = array();
  22430. private $tags;
  22431. private $branches;
  22432. protected $gitDriver;
  22433. private $isPrivate = true;
  22434. protected $portNumber;
  22435. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  22436. public function initialize()
  22437. {
  22438. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  22439. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  22440. }
  22441. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  22442. $configuredDomains = $this->config->get('gitlab-domains');
  22443. $urlParts = explode('/', $match['parts']);
  22444. $this->scheme = !empty($match['scheme'])
  22445. ? $match['scheme']
  22446. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  22447. ;
  22448. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts);
  22449. if (!empty($match['port']) && true === is_numeric($match['port'])) {
  22450. $this->portNumber = (int) $match['port'];
  22451. }
  22452. $this->namespace = implode('/', $urlParts);
  22453. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  22454. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  22455. $this->fetchProject();
  22456. }
  22457. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  22458. {
  22459. $this->remoteFilesystem = $remoteFilesystem;
  22460. }
  22461. public function getFileContent($file, $identifier)
  22462. {
  22463. if ($this->gitDriver) {
  22464. return $this->gitDriver->getFileContent($file, $identifier);
  22465. }
  22466. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  22467. $branches = $this->getBranches();
  22468. if (isset($branches[$identifier])) {
  22469. $identifier = $branches[$identifier];
  22470. }
  22471. }
  22472. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  22473. try {
  22474. $content = $this->getContents($resource);
  22475. } catch (TransportException $e) {
  22476. if ($e->getCode() !== 404) {
  22477. throw $e;
  22478. }
  22479. return null;
  22480. }
  22481. return $content;
  22482. }
  22483. public function getChangeDate($identifier)
  22484. {
  22485. if ($this->gitDriver) {
  22486. return $this->gitDriver->getChangeDate($identifier);
  22487. }
  22488. if (isset($this->commits[$identifier])) {
  22489. return new \DateTime($this->commits[$identifier]['committed_date']);
  22490. }
  22491. return new \DateTime();
  22492. }
  22493. public function getRepositoryUrl()
  22494. {
  22495. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  22496. }
  22497. public function getUrl()
  22498. {
  22499. if ($this->gitDriver) {
  22500. return $this->gitDriver->getUrl();
  22501. }
  22502. return $this->project['web_url'];
  22503. }
  22504. public function getDist($identifier)
  22505. {
  22506. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  22507. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22508. }
  22509. public function getSource($identifier)
  22510. {
  22511. if ($this->gitDriver) {
  22512. return $this->gitDriver->getSource($identifier);
  22513. }
  22514. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  22515. }
  22516. public function getRootIdentifier()
  22517. {
  22518. if ($this->gitDriver) {
  22519. return $this->gitDriver->getRootIdentifier();
  22520. }
  22521. return $this->project['default_branch'];
  22522. }
  22523. public function getBranches()
  22524. {
  22525. if ($this->gitDriver) {
  22526. return $this->gitDriver->getBranches();
  22527. }
  22528. if (!$this->branches) {
  22529. $this->branches = $this->getReferences('branches');
  22530. }
  22531. return $this->branches;
  22532. }
  22533. public function getTags()
  22534. {
  22535. if ($this->gitDriver) {
  22536. return $this->gitDriver->getTags();
  22537. }
  22538. if (!$this->tags) {
  22539. $this->tags = $this->getReferences('tags');
  22540. }
  22541. return $this->tags;
  22542. }
  22543. public function getApiUrl()
  22544. {
  22545. $domainName = $this->originUrl;
  22546. $portNumber = (true === is_numeric($this->portNumber)) ? sprintf(':%s', $this->portNumber) : '';
  22547. return $this->scheme.'://'.$domainName.$portNumber.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  22548. }
  22549. private function urlEncodeAll($string)
  22550. {
  22551. $encoded = '';
  22552. for ($i = 0; isset($string[$i]); $i++) {
  22553. $character = $string[$i];
  22554. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  22555. $character = '%' . sprintf('%02X', ord($character));
  22556. }
  22557. $encoded .= $character;
  22558. }
  22559. return $encoded;
  22560. }
  22561. protected function getReferences($type)
  22562. {
  22563. $perPage = 100;
  22564. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  22565. $references = array();
  22566. do {
  22567. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  22568. foreach ($data as $datum) {
  22569. $references[$datum['name']] = $datum['commit']['id'];
  22570. $this->commits[$datum['commit']['id']] = $datum['commit'];
  22571. }
  22572. if (count($data) >= $perPage) {
  22573. $resource = $this->getNextPage();
  22574. } else {
  22575. $resource = false;
  22576. }
  22577. } while ($resource);
  22578. return $references;
  22579. }
  22580. protected function fetchProject()
  22581. {
  22582. $resource = $this->getApiUrl();
  22583. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  22584. if (isset($this->project['visibility'])) {
  22585. $this->isPrivate = $this->project['visibility'] !== 'public';
  22586. } else {
  22587. $this->isPrivate = false;
  22588. }
  22589. }
  22590. protected function attemptCloneFallback()
  22591. {
  22592. try {
  22593. if ($this->isPrivate === false) {
  22594. $url = $this->generatePublicUrl();
  22595. } else {
  22596. $url = $this->generateSshUrl();
  22597. }
  22598. $this->setupGitDriver($url);
  22599. return;
  22600. } catch (\RuntimeException $e) {
  22601. $this->gitDriver = null;
  22602. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  22603. throw $e;
  22604. }
  22605. }
  22606. protected function generateSshUrl()
  22607. {
  22608. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  22609. }
  22610. protected function generatePublicUrl()
  22611. {
  22612. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  22613. }
  22614. protected function setupGitDriver($url)
  22615. {
  22616. $this->gitDriver = new GitDriver(
  22617. array('url' => $url),
  22618. $this->io,
  22619. $this->config,
  22620. $this->process,
  22621. $this->remoteFilesystem
  22622. );
  22623. $this->gitDriver->initialize();
  22624. }
  22625. protected function getContents($url, $fetchingRepoData = false)
  22626. {
  22627. try {
  22628. $res = parent::getContents($url);
  22629. if ($fetchingRepoData) {
  22630. $json = JsonFile::parseJson($res, $url);
  22631. if (!isset($json['default_branch'])) {
  22632. if (!empty($json['id'])) {
  22633. $this->isPrivate = false;
  22634. }
  22635. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  22636. }
  22637. }
  22638. return $res;
  22639. } catch (TransportException $e) {
  22640. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22641. switch ($e->getCode()) {
  22642. case 401:
  22643. case 404:
  22644. if (!$fetchingRepoData) {
  22645. throw $e;
  22646. }
  22647. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  22648. return parent::getContents($url);
  22649. }
  22650. if (!$this->io->isInteractive()) {
  22651. return $this->attemptCloneFallback();
  22652. }
  22653. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  22654. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  22655. return parent::getContents($url);
  22656. case 403:
  22657. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  22658. return parent::getContents($url);
  22659. }
  22660. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22661. return $this->attemptCloneFallback();
  22662. }
  22663. throw $e;
  22664. default:
  22665. throw $e;
  22666. }
  22667. }
  22668. }
  22669. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22670. {
  22671. if (!preg_match(self::URL_REGEX, $url, $match)) {
  22672. return false;
  22673. }
  22674. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  22675. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  22676. $urlParts = explode('/', $match['parts']);
  22677. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts)) {
  22678. return false;
  22679. }
  22680. if ('https' === $scheme && !extension_loaded('openssl')) {
  22681. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22682. return false;
  22683. }
  22684. return true;
  22685. }
  22686. private function getNextPage()
  22687. {
  22688. $headers = $this->remoteFilesystem->getLastHeaders();
  22689. foreach ($headers as $header) {
  22690. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  22691. $links = explode(',', $match[1]);
  22692. foreach ($links as $link) {
  22693. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  22694. return $match[1];
  22695. }
  22696. }
  22697. }
  22698. }
  22699. }
  22700. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts)
  22701. {
  22702. if (in_array($guessedDomain, $configuredDomains)) {
  22703. return $guessedDomain;
  22704. }
  22705. while (null !== ($part = array_shift($urlParts))) {
  22706. $guessedDomain .= '/' . $part;
  22707. if (in_array($guessedDomain, $configuredDomains)) {
  22708. return $guessedDomain;
  22709. }
  22710. }
  22711. return false;
  22712. }
  22713. }
  22714. <?php
  22715. namespace Composer\Repository\Vcs;
  22716. use Composer\Config;
  22717. use Composer\IO\IOInterface;
  22718. class HgBitbucketDriver extends BitbucketDriver
  22719. {
  22720. public function getRootIdentifier()
  22721. {
  22722. if ($this->fallbackDriver) {
  22723. return $this->fallbackDriver->getRootIdentifier();
  22724. }
  22725. if (null === $this->rootIdentifier) {
  22726. if (! $this->getRepoData()) {
  22727. return $this->fallbackDriver->getRootIdentifier();
  22728. }
  22729. if ($this->vcsType !== 'hg') {
  22730. throw new \RuntimeException(
  22731. $this->url.' does not appear to be a mercurial repository, use '.
  22732. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  22733. );
  22734. }
  22735. $mainBranchData = $this->getMainBranchData();
  22736. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  22737. }
  22738. return $this->rootIdentifier;
  22739. }
  22740. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22741. {
  22742. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
  22743. return false;
  22744. }
  22745. if (!extension_loaded('openssl')) {
  22746. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22747. return false;
  22748. }
  22749. return true;
  22750. }
  22751. protected function setupFallbackDriver($url)
  22752. {
  22753. $this->fallbackDriver = new HgDriver(
  22754. array('url' => $url),
  22755. $this->io,
  22756. $this->config,
  22757. $this->process,
  22758. $this->remoteFilesystem
  22759. );
  22760. $this->fallbackDriver->initialize();
  22761. }
  22762. protected function generateSshUrl()
  22763. {
  22764. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  22765. }
  22766. }
  22767. <?php
  22768. namespace Composer\Repository\Vcs;
  22769. use Composer\Config;
  22770. use Composer\Util\ProcessExecutor;
  22771. use Composer\Util\Filesystem;
  22772. use Composer\IO\IOInterface;
  22773. class HgDriver extends VcsDriver
  22774. {
  22775. protected $tags;
  22776. protected $branches;
  22777. protected $rootIdentifier;
  22778. protected $repoDir;
  22779. protected $infoCache = array();
  22780. public function initialize()
  22781. {
  22782. if (Filesystem::isLocalPath($this->url)) {
  22783. $this->repoDir = $this->url;
  22784. } else {
  22785. $cacheDir = $this->config->get('cache-vcs-dir');
  22786. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  22787. $fs = new Filesystem();
  22788. $fs->ensureDirectoryExists($cacheDir);
  22789. if (!is_writable(dirname($this->repoDir))) {
  22790. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  22791. }
  22792. $this->config->prohibitUrlByConfig($this->url, $this->io);
  22793. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  22794. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  22795. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  22796. }
  22797. } else {
  22798. $fs->removeDirectory($this->repoDir);
  22799. if (0 !== $this->process->execute(sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoDir)), $output, $cacheDir)) {
  22800. $output = $this->process->getErrorOutput();
  22801. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  22802. throw new \RuntimeException('Failed to clone '.$this->url.', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  22803. }
  22804. throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);
  22805. }
  22806. }
  22807. }
  22808. $this->getTags();
  22809. $this->getBranches();
  22810. }
  22811. public function getRootIdentifier()
  22812. {
  22813. if (null === $this->rootIdentifier) {
  22814. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  22815. $output = $this->process->splitLines($output);
  22816. $this->rootIdentifier = $output[0];
  22817. }
  22818. return $this->rootIdentifier;
  22819. }
  22820. public function getUrl()
  22821. {
  22822. return $this->url;
  22823. }
  22824. public function getSource($identifier)
  22825. {
  22826. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  22827. }
  22828. public function getDist($identifier)
  22829. {
  22830. return null;
  22831. }
  22832. public function getFileContent($file, $identifier)
  22833. {
  22834. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22835. $this->process->execute($resource, $content, $this->repoDir);
  22836. if (!trim($content)) {
  22837. return;
  22838. }
  22839. return $content;
  22840. }
  22841. public function getChangeDate($identifier)
  22842. {
  22843. $this->process->execute(
  22844. sprintf(
  22845. 'hg log --template "{date|rfc3339date}" -r %s',
  22846. ProcessExecutor::escape($identifier)
  22847. ),
  22848. $output,
  22849. $this->repoDir
  22850. );
  22851. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  22852. }
  22853. public function getTags()
  22854. {
  22855. if (null === $this->tags) {
  22856. $tags = array();
  22857. $this->process->execute('hg tags', $output, $this->repoDir);
  22858. foreach ($this->process->splitLines($output) as $tag) {
  22859. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  22860. $tags[$match[1]] = $match[2];
  22861. }
  22862. }
  22863. unset($tags['tip']);
  22864. $this->tags = $tags;
  22865. }
  22866. return $this->tags;
  22867. }
  22868. public function getBranches()
  22869. {
  22870. if (null === $this->branches) {
  22871. $branches = array();
  22872. $bookmarks = array();
  22873. $this->process->execute('hg branches', $output, $this->repoDir);
  22874. foreach ($this->process->splitLines($output) as $branch) {
  22875. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  22876. $branches[$match[1]] = $match[2];
  22877. }
  22878. }
  22879. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  22880. foreach ($this->process->splitLines($output) as $branch) {
  22881. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  22882. $bookmarks[$match[1]] = $match[2];
  22883. }
  22884. }
  22885. $this->branches = array_merge($bookmarks, $branches);
  22886. }
  22887. return $this->branches;
  22888. }
  22889. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22890. {
  22891. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  22892. return true;
  22893. }
  22894. if (Filesystem::isLocalPath($url)) {
  22895. $url = Filesystem::getPlatformPath($url);
  22896. if (!is_dir($url)) {
  22897. return false;
  22898. }
  22899. $process = new ProcessExecutor();
  22900. if ($process->execute('hg summary', $output, $url) === 0) {
  22901. return true;
  22902. }
  22903. }
  22904. if (!$deep) {
  22905. return false;
  22906. }
  22907. $processExecutor = new ProcessExecutor();
  22908. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  22909. return $exit === 0;
  22910. }
  22911. }
  22912. <?php
  22913. namespace Composer\Repository\Vcs;
  22914. use Composer\Config;
  22915. use Composer\IO\IOInterface;
  22916. use Composer\Util\ProcessExecutor;
  22917. use Composer\Util\Perforce;
  22918. class PerforceDriver extends VcsDriver
  22919. {
  22920. protected $depot;
  22921. protected $branch;
  22922. protected $perforce;
  22923. public function initialize()
  22924. {
  22925. $this->depot = $this->repoConfig['depot'];
  22926. $this->branch = '';
  22927. if (!empty($this->repoConfig['branch'])) {
  22928. $this->branch = $this->repoConfig['branch'];
  22929. }
  22930. $this->initPerforce($this->repoConfig);
  22931. $this->perforce->p4Login();
  22932. $this->perforce->checkStream();
  22933. $this->perforce->writeP4ClientSpec();
  22934. $this->perforce->connectClient();
  22935. return true;
  22936. }
  22937. private function initPerforce($repoConfig)
  22938. {
  22939. if (!empty($this->perforce)) {
  22940. return;
  22941. }
  22942. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  22943. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  22944. }
  22945. public function getFileContent($file, $identifier)
  22946. {
  22947. return $this->perforce->getFileContent($file, $identifier);
  22948. }
  22949. public function getChangeDate($identifier)
  22950. {
  22951. return null;
  22952. }
  22953. public function getRootIdentifier()
  22954. {
  22955. return $this->branch;
  22956. }
  22957. public function getBranches()
  22958. {
  22959. return $this->perforce->getBranches();
  22960. }
  22961. public function getTags()
  22962. {
  22963. return $this->perforce->getTags();
  22964. }
  22965. public function getDist($identifier)
  22966. {
  22967. return null;
  22968. }
  22969. public function getSource($identifier)
  22970. {
  22971. $source = array(
  22972. 'type' => 'perforce',
  22973. 'url' => $this->repoConfig['url'],
  22974. 'reference' => $identifier,
  22975. 'p4user' => $this->perforce->getUser(),
  22976. );
  22977. return $source;
  22978. }
  22979. public function getUrl()
  22980. {
  22981. return $this->url;
  22982. }
  22983. public function hasComposerFile($identifier)
  22984. {
  22985. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  22986. $composerInfoIdentifier = $identifier;
  22987. return !empty($composerInfo);
  22988. }
  22989. public function getContents($url)
  22990. {
  22991. return false;
  22992. }
  22993. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22994. {
  22995. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  22996. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  22997. }
  22998. return false;
  22999. }
  23000. public function cleanup()
  23001. {
  23002. $this->perforce->cleanupClientSpec();
  23003. $this->perforce = null;
  23004. }
  23005. public function getDepot()
  23006. {
  23007. return $this->depot;
  23008. }
  23009. public function getBranch()
  23010. {
  23011. return $this->branch;
  23012. }
  23013. }
  23014. <?php
  23015. namespace Composer\Repository\Vcs;
  23016. use Composer\Cache;
  23017. use Composer\Config;
  23018. use Composer\Json\JsonFile;
  23019. use Composer\Util\ProcessExecutor;
  23020. use Composer\Util\Filesystem;
  23021. use Composer\Util\Svn as SvnUtil;
  23022. use Composer\IO\IOInterface;
  23023. use Composer\Downloader\TransportException;
  23024. class SvnDriver extends VcsDriver
  23025. {
  23026. protected $cache;
  23027. protected $baseUrl;
  23028. protected $tags;
  23029. protected $branches;
  23030. protected $rootIdentifier;
  23031. protected $infoCache = array();
  23032. protected $trunkPath = 'trunk';
  23033. protected $branchesPath = 'branches';
  23034. protected $tagsPath = 'tags';
  23035. protected $packagePath = '';
  23036. protected $cacheCredentials = true;
  23037. private $util;
  23038. public function initialize()
  23039. {
  23040. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  23041. SvnUtil::cleanEnv();
  23042. if (isset($this->repoConfig['trunk-path'])) {
  23043. $this->trunkPath = $this->repoConfig['trunk-path'];
  23044. }
  23045. if (isset($this->repoConfig['branches-path'])) {
  23046. $this->branchesPath = $this->repoConfig['branches-path'];
  23047. }
  23048. if (isset($this->repoConfig['tags-path'])) {
  23049. $this->tagsPath = $this->repoConfig['tags-path'];
  23050. }
  23051. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  23052. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  23053. }
  23054. if (isset($this->repoConfig['package-path'])) {
  23055. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  23056. }
  23057. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  23058. $this->baseUrl = substr($this->url, 0, $pos);
  23059. }
  23060. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  23061. $this->getBranches();
  23062. $this->getTags();
  23063. }
  23064. public function getRootIdentifier()
  23065. {
  23066. return $this->rootIdentifier ?: $this->trunkPath;
  23067. }
  23068. public function getUrl()
  23069. {
  23070. return $this->url;
  23071. }
  23072. public function getSource($identifier)
  23073. {
  23074. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  23075. }
  23076. public function getDist($identifier)
  23077. {
  23078. return null;
  23079. }
  23080. public function getComposerInformation($identifier)
  23081. {
  23082. if (!isset($this->infoCache[$identifier])) {
  23083. if ($res = $this->cache->read($identifier.'.json')) {
  23084. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23085. }
  23086. $composer = $this->getBaseComposerInformation($identifier);
  23087. $this->cache->write($identifier.'.json', json_encode($composer));
  23088. $this->infoCache[$identifier] = $composer;
  23089. }
  23090. return $this->infoCache[$identifier];
  23091. }
  23092. public function getFileContent($file, $identifier)
  23093. {
  23094. $identifier = '/' . trim($identifier, '/') . '/';
  23095. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23096. if (!empty($match[2])) {
  23097. $path = $match[1];
  23098. $rev = $match[2];
  23099. } else {
  23100. $path = $identifier;
  23101. $rev = '';
  23102. }
  23103. try {
  23104. $resource = $path.$file;
  23105. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  23106. if (!trim($output)) {
  23107. return null;
  23108. }
  23109. } catch (\RuntimeException $e) {
  23110. throw new TransportException($e->getMessage());
  23111. }
  23112. return $output;
  23113. }
  23114. public function getChangeDate($identifier)
  23115. {
  23116. $identifier = '/' . trim($identifier, '/') . '/';
  23117. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23118. if (!empty($match[2])) {
  23119. $path = $match[1];
  23120. $rev = $match[2];
  23121. } else {
  23122. $path = $identifier;
  23123. $rev = '';
  23124. }
  23125. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  23126. foreach ($this->process->splitLines($output) as $line) {
  23127. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  23128. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  23129. }
  23130. }
  23131. return null;
  23132. }
  23133. public function getTags()
  23134. {
  23135. if (null === $this->tags) {
  23136. $this->tags = array();
  23137. if ($this->tagsPath !== false) {
  23138. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  23139. if ($output) {
  23140. foreach ($this->process->splitLines($output) as $line) {
  23141. $line = trim($line);
  23142. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23143. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23144. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  23145. '/' . $this->tagsPath . '/' . $match[2],
  23146. $match[1]
  23147. );
  23148. }
  23149. }
  23150. }
  23151. }
  23152. }
  23153. }
  23154. return $this->tags;
  23155. }
  23156. public function getBranches()
  23157. {
  23158. if (null === $this->branches) {
  23159. $this->branches = array();
  23160. if (false === $this->trunkPath) {
  23161. $trunkParent = $this->baseUrl . '/';
  23162. } else {
  23163. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  23164. }
  23165. $output = $this->execute('svn ls --verbose', $trunkParent);
  23166. if ($output) {
  23167. foreach ($this->process->splitLines($output) as $line) {
  23168. $line = trim($line);
  23169. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23170. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  23171. $this->branches['trunk'] = $this->buildIdentifier(
  23172. '/' . $this->trunkPath,
  23173. $match[1]
  23174. );
  23175. $this->rootIdentifier = $this->branches['trunk'];
  23176. break;
  23177. }
  23178. }
  23179. }
  23180. }
  23181. unset($output);
  23182. if ($this->branchesPath !== false) {
  23183. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  23184. if ($output) {
  23185. foreach ($this->process->splitLines(trim($output)) as $line) {
  23186. $line = trim($line);
  23187. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23188. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23189. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  23190. '/' . $this->branchesPath . '/' . $match[2],
  23191. $match[1]
  23192. );
  23193. }
  23194. }
  23195. }
  23196. }
  23197. }
  23198. }
  23199. return $this->branches;
  23200. }
  23201. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23202. {
  23203. $url = self::normalizeUrl($url);
  23204. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  23205. return true;
  23206. }
  23207. if (!$deep && !Filesystem::isLocalPath($url)) {
  23208. return false;
  23209. }
  23210. $processExecutor = new ProcessExecutor();
  23211. $exit = $processExecutor->execute(
  23212. "svn info --non-interactive {$url}",
  23213. $ignoredOutput
  23214. );
  23215. if ($exit === 0) {
  23216. return true;
  23217. }
  23218. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  23219. return true;
  23220. }
  23221. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  23222. return true;
  23223. }
  23224. return false;
  23225. }
  23226. protected static function normalizeUrl($url)
  23227. {
  23228. $fs = new Filesystem();
  23229. if ($fs->isAbsolutePath($url)) {
  23230. return 'file://' . strtr($url, '\\', '/');
  23231. }
  23232. return $url;
  23233. }
  23234. protected function execute($command, $url)
  23235. {
  23236. if (null === $this->util) {
  23237. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  23238. $this->util->setCacheCredentials($this->cacheCredentials);
  23239. }
  23240. try {
  23241. return $this->util->execute($command, $url);
  23242. } catch (\RuntimeException $e) {
  23243. if (0 !== $this->process->execute('svn --version', $ignoredOutput)) {
  23244. 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());
  23245. }
  23246. throw new \RuntimeException(
  23247. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  23248. );
  23249. }
  23250. }
  23251. protected function buildIdentifier($baseDir, $revision)
  23252. {
  23253. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  23254. }
  23255. }
  23256. <?php
  23257. namespace Composer\Repository\Vcs;
  23258. use Composer\Cache;
  23259. use Composer\Downloader\TransportException;
  23260. use Composer\Config;
  23261. use Composer\Factory;
  23262. use Composer\IO\IOInterface;
  23263. use Composer\Json\JsonFile;
  23264. use Composer\Util\ProcessExecutor;
  23265. use Composer\Util\RemoteFilesystem;
  23266. use Composer\Util\Filesystem;
  23267. abstract class VcsDriver implements VcsDriverInterface
  23268. {
  23269. protected $url;
  23270. protected $originUrl;
  23271. protected $repoConfig;
  23272. protected $io;
  23273. protected $config;
  23274. protected $process;
  23275. protected $remoteFilesystem;
  23276. protected $infoCache = array();
  23277. protected $cache;
  23278. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  23279. {
  23280. if (Filesystem::isLocalPath($repoConfig['url'])) {
  23281. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  23282. }
  23283. $this->url = $repoConfig['url'];
  23284. $this->originUrl = $repoConfig['url'];
  23285. $this->repoConfig = $repoConfig;
  23286. $this->io = $io;
  23287. $this->config = $config;
  23288. $this->process = $process ?: new ProcessExecutor($io);
  23289. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23290. }
  23291. protected function shouldCache($identifier)
  23292. {
  23293. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  23294. }
  23295. public function getComposerInformation($identifier)
  23296. {
  23297. if (!isset($this->infoCache[$identifier])) {
  23298. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23299. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23300. }
  23301. $composer = $this->getBaseComposerInformation($identifier);
  23302. if ($this->shouldCache($identifier)) {
  23303. $this->cache->write($identifier, json_encode($composer));
  23304. }
  23305. $this->infoCache[$identifier] = $composer;
  23306. }
  23307. return $this->infoCache[$identifier];
  23308. }
  23309. protected function getBaseComposerInformation($identifier)
  23310. {
  23311. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  23312. if (!$composerFileContent) {
  23313. return null;
  23314. }
  23315. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  23316. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  23317. $composer['time'] = $changeDate->format(DATE_RFC3339);
  23318. }
  23319. return $composer;
  23320. }
  23321. public function hasComposerFile($identifier)
  23322. {
  23323. try {
  23324. return (bool) $this->getComposerInformation($identifier);
  23325. } catch (TransportException $e) {
  23326. }
  23327. return false;
  23328. }
  23329. protected function getScheme()
  23330. {
  23331. if (extension_loaded('openssl')) {
  23332. return 'https';
  23333. }
  23334. return 'http';
  23335. }
  23336. protected function getContents($url)
  23337. {
  23338. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  23339. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  23340. }
  23341. public function cleanup()
  23342. {
  23343. return;
  23344. }
  23345. }
  23346. <?php
  23347. namespace Composer\Repository\Vcs;
  23348. use Composer\Config;
  23349. use Composer\IO\IOInterface;
  23350. interface VcsDriverInterface
  23351. {
  23352. public function initialize();
  23353. public function getComposerInformation($identifier);
  23354. public function getFileContent($file, $identifier);
  23355. public function getChangeDate($identifier);
  23356. public function getRootIdentifier();
  23357. public function getBranches();
  23358. public function getTags();
  23359. public function getDist($identifier);
  23360. public function getSource($identifier);
  23361. public function getUrl();
  23362. public function hasComposerFile($identifier);
  23363. public function cleanup();
  23364. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  23365. }
  23366. <?php
  23367. namespace Composer\Repository;
  23368. use Composer\Downloader\TransportException;
  23369. use Composer\Repository\Vcs\VcsDriverInterface;
  23370. use Composer\Package\Version\VersionParser;
  23371. use Composer\Package\Loader\ArrayLoader;
  23372. use Composer\Package\Loader\ValidatingArrayLoader;
  23373. use Composer\Package\Loader\InvalidPackageException;
  23374. use Composer\Package\Loader\LoaderInterface;
  23375. use Composer\EventDispatcher\EventDispatcher;
  23376. use Composer\IO\IOInterface;
  23377. use Composer\Config;
  23378. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  23379. {
  23380. protected $url;
  23381. protected $packageName;
  23382. protected $verbose;
  23383. protected $io;
  23384. protected $config;
  23385. protected $versionParser;
  23386. protected $type;
  23387. protected $loader;
  23388. protected $repoConfig;
  23389. protected $branchErrorOccurred = false;
  23390. private $drivers;
  23391. private $driver;
  23392. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null)
  23393. {
  23394. parent::__construct();
  23395. $this->drivers = $drivers ?: array(
  23396. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  23397. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  23398. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  23399. 'git' => 'Composer\Repository\Vcs\GitDriver',
  23400. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  23401. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  23402. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  23403. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  23404. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  23405. );
  23406. $this->url = $repoConfig['url'];
  23407. $this->io = $io;
  23408. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  23409. $this->verbose = $io->isVeryVerbose();
  23410. $this->config = $config;
  23411. $this->repoConfig = $repoConfig;
  23412. }
  23413. public function getRepoConfig()
  23414. {
  23415. return $this->repoConfig;
  23416. }
  23417. public function setLoader(LoaderInterface $loader)
  23418. {
  23419. $this->loader = $loader;
  23420. }
  23421. public function getDriver()
  23422. {
  23423. if ($this->driver) {
  23424. return $this->driver;
  23425. }
  23426. if (isset($this->drivers[$this->type])) {
  23427. $class = $this->drivers[$this->type];
  23428. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  23429. $this->driver->initialize();
  23430. return $this->driver;
  23431. }
  23432. foreach ($this->drivers as $driver) {
  23433. if ($driver::supports($this->io, $this->config, $this->url)) {
  23434. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  23435. $this->driver->initialize();
  23436. return $this->driver;
  23437. }
  23438. }
  23439. foreach ($this->drivers as $driver) {
  23440. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  23441. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  23442. $this->driver->initialize();
  23443. return $this->driver;
  23444. }
  23445. }
  23446. }
  23447. public function hadInvalidBranches()
  23448. {
  23449. return $this->branchErrorOccurred;
  23450. }
  23451. protected function initialize()
  23452. {
  23453. parent::initialize();
  23454. $verbose = $this->verbose;
  23455. $driver = $this->getDriver();
  23456. if (!$driver) {
  23457. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  23458. }
  23459. $this->versionParser = new VersionParser;
  23460. if (!$this->loader) {
  23461. $this->loader = new ArrayLoader($this->versionParser);
  23462. }
  23463. try {
  23464. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  23465. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  23466. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  23467. }
  23468. } catch (\Exception $e) {
  23469. if ($verbose) {
  23470. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  23471. }
  23472. }
  23473. foreach ($driver->getTags() as $tag => $identifier) {
  23474. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  23475. if ($verbose) {
  23476. $this->io->writeError($msg);
  23477. } else {
  23478. $this->io->overwriteError($msg, false);
  23479. }
  23480. $tag = str_replace('release-', '', $tag);
  23481. if (!$parsedTag = $this->validateTag($tag)) {
  23482. if ($verbose) {
  23483. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  23484. }
  23485. continue;
  23486. }
  23487. try {
  23488. if (!$data = $driver->getComposerInformation($identifier)) {
  23489. if ($verbose) {
  23490. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  23491. }
  23492. continue;
  23493. }
  23494. if (isset($data['version'])) {
  23495. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  23496. } else {
  23497. $data['version'] = $tag;
  23498. $data['version_normalized'] = $parsedTag;
  23499. }
  23500. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  23501. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  23502. if ($data['version_normalized'] !== $parsedTag) {
  23503. if ($verbose) {
  23504. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  23505. }
  23506. continue;
  23507. }
  23508. if ($existingPackage = $this->findPackage($data['name'], $data['version_normalized'])) {
  23509. if ($verbose) {
  23510. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  23511. }
  23512. continue;
  23513. }
  23514. if ($verbose) {
  23515. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  23516. }
  23517. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  23518. } catch (\Exception $e) {
  23519. if ($verbose) {
  23520. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  23521. }
  23522. continue;
  23523. }
  23524. }
  23525. if (!$verbose) {
  23526. $this->io->overwriteError('', false);
  23527. }
  23528. $branches = $driver->getBranches();
  23529. foreach ($branches as $branch => $identifier) {
  23530. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  23531. if ($verbose) {
  23532. $this->io->writeError($msg);
  23533. } else {
  23534. $this->io->overwriteError($msg, false);
  23535. }
  23536. if ($branch === 'trunk' && isset($branches['master'])) {
  23537. if ($verbose) {
  23538. $this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
  23539. }
  23540. continue;
  23541. }
  23542. if (!$parsedBranch = $this->validateBranch($branch)) {
  23543. if ($verbose) {
  23544. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  23545. }
  23546. continue;
  23547. }
  23548. try {
  23549. if (!$data = $driver->getComposerInformation($identifier)) {
  23550. if ($verbose) {
  23551. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  23552. }
  23553. continue;
  23554. }
  23555. $data['version'] = $branch;
  23556. $data['version_normalized'] = $parsedBranch;
  23557. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  23558. $data['version'] = 'dev-' . $data['version'];
  23559. } else {
  23560. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  23561. $data['version'] = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  23562. }
  23563. if ($verbose) {
  23564. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  23565. }
  23566. $packageData = $this->preProcess($driver, $data, $identifier);
  23567. $package = $this->loader->load($packageData);
  23568. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  23569. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  23570. }
  23571. $this->addPackage($package);
  23572. } catch (TransportException $e) {
  23573. if ($verbose) {
  23574. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  23575. }
  23576. continue;
  23577. } catch (\Exception $e) {
  23578. if (!$verbose) {
  23579. $this->io->writeError('');
  23580. }
  23581. $this->branchErrorOccurred = true;
  23582. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  23583. $this->io->writeError('');
  23584. continue;
  23585. }
  23586. }
  23587. $driver->cleanup();
  23588. if (!$verbose) {
  23589. $this->io->overwriteError('', false);
  23590. }
  23591. if (!$this->getPackages()) {
  23592. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  23593. }
  23594. }
  23595. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  23596. {
  23597. $data['name'] = $this->packageName ?: $data['name'];
  23598. if (!isset($data['dist'])) {
  23599. $data['dist'] = $driver->getDist($identifier);
  23600. }
  23601. if (!isset($data['source'])) {
  23602. $data['source'] = $driver->getSource($identifier);
  23603. }
  23604. return $data;
  23605. }
  23606. private function validateBranch($branch)
  23607. {
  23608. try {
  23609. return $this->versionParser->normalizeBranch($branch);
  23610. } catch (\Exception $e) {
  23611. }
  23612. return false;
  23613. }
  23614. private function validateTag($version)
  23615. {
  23616. try {
  23617. return $this->versionParser->normalize($version);
  23618. } catch (\Exception $e) {
  23619. }
  23620. return false;
  23621. }
  23622. }
  23623. <?php
  23624. namespace Composer\Repository;
  23625. use Composer\Package\AliasPackage;
  23626. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  23627. {
  23628. public function write()
  23629. {
  23630. }
  23631. public function reload()
  23632. {
  23633. }
  23634. public function getCanonicalPackages()
  23635. {
  23636. $packages = $this->getPackages();
  23637. $packagesByName = array();
  23638. foreach ($packages as $package) {
  23639. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  23640. $packagesByName[$package->getName()] = $package;
  23641. }
  23642. }
  23643. $canonicalPackages = array();
  23644. foreach ($packagesByName as $package) {
  23645. while ($package instanceof AliasPackage) {
  23646. $package = $package->getAliasOf();
  23647. }
  23648. $canonicalPackages[] = $package;
  23649. }
  23650. return $canonicalPackages;
  23651. }
  23652. }
  23653. <?php
  23654. namespace Composer\Repository;
  23655. use Composer\Package\PackageInterface;
  23656. interface WritableRepositoryInterface extends RepositoryInterface
  23657. {
  23658. public function write();
  23659. public function addPackage(PackageInterface $package);
  23660. public function removePackage(PackageInterface $package);
  23661. public function getCanonicalPackages();
  23662. public function reload();
  23663. }
  23664. <?php
  23665. namespace Composer\Script;
  23666. class CommandEvent extends Event
  23667. {
  23668. }
  23669. <?php
  23670. namespace Composer\Script;
  23671. use Composer\Composer;
  23672. use Composer\IO\IOInterface;
  23673. use Composer\EventDispatcher\Event as BaseEvent;
  23674. class Event extends BaseEvent
  23675. {
  23676. private $composer;
  23677. private $io;
  23678. private $devMode;
  23679. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  23680. {
  23681. parent::__construct($name, $args, $flags);
  23682. $this->composer = $composer;
  23683. $this->io = $io;
  23684. $this->devMode = $devMode;
  23685. }
  23686. public function getComposer()
  23687. {
  23688. return $this->composer;
  23689. }
  23690. public function getIO()
  23691. {
  23692. return $this->io;
  23693. }
  23694. public function isDevMode()
  23695. {
  23696. return $this->devMode;
  23697. }
  23698. }
  23699. <?php
  23700. namespace Composer\Script;
  23701. use Composer\Installer\PackageEvent as BasePackageEvent;
  23702. class PackageEvent extends BasePackageEvent
  23703. {
  23704. }
  23705. <?php
  23706. namespace Composer\Script;
  23707. class ScriptEvents
  23708. {
  23709. const PRE_INSTALL_CMD = 'pre-install-cmd';
  23710. const POST_INSTALL_CMD = 'post-install-cmd';
  23711. const PRE_UPDATE_CMD = 'pre-update-cmd';
  23712. const POST_UPDATE_CMD = 'post-update-cmd';
  23713. const PRE_STATUS_CMD = 'pre-status-cmd';
  23714. const POST_STATUS_CMD = 'post-status-cmd';
  23715. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  23716. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  23717. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  23718. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  23719. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  23720. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  23721. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  23722. const POST_PACKAGE_INSTALL = 'post-package-install';
  23723. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  23724. const POST_PACKAGE_UPDATE = 'post-package-update';
  23725. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  23726. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  23727. }
  23728. <?php
  23729. namespace Composer\SelfUpdate;
  23730. class Keys
  23731. {
  23732. public static function fingerprint($path)
  23733. {
  23734. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  23735. return implode(' ', array(
  23736. substr($hash, 0, 8),
  23737. substr($hash, 8, 8),
  23738. substr($hash, 16, 8),
  23739. substr($hash, 24, 8),
  23740. '',
  23741. substr($hash, 32, 8),
  23742. substr($hash, 40, 8),
  23743. substr($hash, 48, 8),
  23744. substr($hash, 56, 8),
  23745. ));
  23746. }
  23747. }
  23748. <?php
  23749. namespace Composer\SelfUpdate;
  23750. use Composer\Util\RemoteFilesystem;
  23751. use Composer\Config;
  23752. use Composer\Json\JsonFile;
  23753. class Versions
  23754. {
  23755. private $rfs;
  23756. private $config;
  23757. private $channel;
  23758. public function __construct(Config $config, RemoteFilesystem $rfs)
  23759. {
  23760. $this->rfs = $rfs;
  23761. $this->config = $config;
  23762. }
  23763. public function getChannel()
  23764. {
  23765. if ($this->channel) {
  23766. return $this->channel;
  23767. }
  23768. $channelFile = $this->config->get('home').'/update-channel';
  23769. if (file_exists($channelFile)) {
  23770. $channel = trim(file_get_contents($channelFile));
  23771. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  23772. return $this->channel = $channel;
  23773. }
  23774. }
  23775. return $this->channel = 'stable';
  23776. }
  23777. public function setChannel($channel)
  23778. {
  23779. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  23780. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  23781. }
  23782. $channelFile = $this->config->get('home').'/update-channel';
  23783. $this->channel = $channel;
  23784. file_put_contents($channelFile, $channel.PHP_EOL);
  23785. }
  23786. public function getLatest()
  23787. {
  23788. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  23789. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  23790. foreach ($versions[$this->getChannel()] as $version) {
  23791. if ($version['min-php'] <= PHP_VERSION_ID) {
  23792. return $version;
  23793. }
  23794. }
  23795. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  23796. }
  23797. }
  23798. <?php
  23799. namespace Composer\Util;
  23800. use Composer\Config;
  23801. use Composer\IO\IOInterface;
  23802. class AuthHelper
  23803. {
  23804. protected $io;
  23805. protected $config;
  23806. public function __construct(IOInterface $io, Config $config)
  23807. {
  23808. $this->io = $io;
  23809. $this->config = $config;
  23810. }
  23811. public function storeAuth($originUrl, $storeAuth)
  23812. {
  23813. $store = false;
  23814. $configSource = $this->config->getAuthConfigSource();
  23815. if ($storeAuth === true) {
  23816. $store = $configSource;
  23817. } elseif ($storeAuth === 'prompt') {
  23818. $answer = $this->io->askAndValidate(
  23819. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  23820. function ($value) {
  23821. $input = strtolower(substr(trim($value), 0, 1));
  23822. if (in_array($input, array('y','n'))) {
  23823. return $input;
  23824. }
  23825. throw new \RuntimeException('Please answer (y)es or (n)o');
  23826. },
  23827. null,
  23828. 'y'
  23829. );
  23830. if ($answer === 'y') {
  23831. $store = $configSource;
  23832. }
  23833. }
  23834. if ($store) {
  23835. $store->addConfigSetting(
  23836. 'http-basic.'.$originUrl,
  23837. $this->io->getAuthentication($originUrl)
  23838. );
  23839. }
  23840. }
  23841. }
  23842. <?php
  23843. namespace Composer\Util;
  23844. use Composer\Factory;
  23845. use Composer\IO\IOInterface;
  23846. use Composer\Config;
  23847. use Composer\Downloader\TransportException;
  23848. class Bitbucket
  23849. {
  23850. private $io;
  23851. private $config;
  23852. private $process;
  23853. private $remoteFilesystem;
  23854. private $token = array();
  23855. private $time;
  23856. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  23857. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  23858. {
  23859. $this->io = $io;
  23860. $this->config = $config;
  23861. $this->process = $process ?: new ProcessExecutor;
  23862. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23863. $this->time = $time;
  23864. }
  23865. public function getToken()
  23866. {
  23867. if (!isset($this->token['access_token'])) {
  23868. return '';
  23869. }
  23870. return $this->token['access_token'];
  23871. }
  23872. public function authorizeOAuth($originUrl)
  23873. {
  23874. if ($originUrl !== 'bitbucket.org') {
  23875. return false;
  23876. }
  23877. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  23878. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  23879. return true;
  23880. }
  23881. return false;
  23882. }
  23883. private function requestAccessToken($originUrl)
  23884. {
  23885. try {
  23886. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  23887. 'retry-auth-failure' => false,
  23888. 'http' => array(
  23889. 'method' => 'POST',
  23890. 'content' => 'grant_type=client_credentials',
  23891. ),
  23892. ));
  23893. $this->token = json_decode($json, true);
  23894. } catch (TransportException $e) {
  23895. if ($e->getCode() === 400) {
  23896. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  23897. $this->io->writeError('This can have two reasons:');
  23898. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  23899. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  23900. return false;
  23901. } elseif (in_array($e->getCode(), array(403, 401))) {
  23902. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  23903. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  23904. return false;
  23905. }
  23906. throw $e;
  23907. }
  23908. return true;
  23909. }
  23910. public function authorizeOAuthInteractively($originUrl, $message = null)
  23911. {
  23912. if ($message) {
  23913. $this->io->writeError($message);
  23914. }
  23915. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  23916. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  23917. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  23918. $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)');
  23919. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  23920. if (!$consumerKey) {
  23921. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  23922. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  23923. return false;
  23924. }
  23925. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  23926. if (!$consumerSecret) {
  23927. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  23928. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  23929. return false;
  23930. }
  23931. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  23932. if (!$this->requestAccessToken($originUrl)) {
  23933. return false;
  23934. }
  23935. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  23936. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  23937. $this->io->writeError('<info>Consumer stored successfully.</info>');
  23938. return true;
  23939. }
  23940. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  23941. {
  23942. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  23943. return $this->token['access_token'];
  23944. }
  23945. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  23946. if (!$this->requestAccessToken($originUrl)) {
  23947. return '';
  23948. }
  23949. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  23950. return $this->token['access_token'];
  23951. }
  23952. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  23953. {
  23954. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  23955. $time = null === $this->time ? time() : $this->time;
  23956. $consumer = array(
  23957. "consumer-key" => $consumerKey,
  23958. "consumer-secret" => $consumerSecret,
  23959. "access-token" => $this->token['access_token'],
  23960. "access-token-expiration" => $time + $this->token['expires_in'],
  23961. );
  23962. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  23963. }
  23964. private function getTokenFromConfig($originUrl)
  23965. {
  23966. $authConfig = $this->config->get('bitbucket-oauth');
  23967. if (
  23968. !isset($authConfig[$originUrl]['access-token'])
  23969. || !isset($authConfig[$originUrl]['access-token-expiration'])
  23970. || time() > $authConfig[$originUrl]['access-token-expiration']
  23971. ) {
  23972. return false;
  23973. }
  23974. $this->token = array(
  23975. 'access_token' => $authConfig[$originUrl]['access-token'],
  23976. );
  23977. return true;
  23978. }
  23979. }
  23980. <?php
  23981. namespace Composer\Util;
  23982. class ComposerMirror
  23983. {
  23984. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  23985. {
  23986. if ($reference) {
  23987. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  23988. }
  23989. $version = strpos($version, '/') === false ? $version : md5($version);
  23990. return str_replace(
  23991. array('%package%', '%version%', '%reference%', '%type%'),
  23992. array($packageName, $version, $reference, $type),
  23993. $mirrorUrl
  23994. );
  23995. }
  23996. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  23997. {
  23998. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  23999. $url = 'gh-'.$match[1].'/'.$match[2];
  24000. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  24001. $url = 'bb-'.$match[1].'/'.$match[2];
  24002. } else {
  24003. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  24004. }
  24005. return str_replace(
  24006. array('%package%', '%normalizedUrl%', '%type%'),
  24007. array($packageName, $url, $type),
  24008. $mirrorUrl
  24009. );
  24010. }
  24011. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  24012. {
  24013. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  24014. }
  24015. }
  24016. <?php
  24017. namespace Composer\Util;
  24018. use Composer\Package\Loader\ArrayLoader;
  24019. use Composer\Package\Loader\ValidatingArrayLoader;
  24020. use Composer\Package\Loader\InvalidPackageException;
  24021. use Composer\Json\JsonValidationException;
  24022. use Composer\IO\IOInterface;
  24023. use Composer\Json\JsonFile;
  24024. use Composer\Spdx\SpdxLicenses;
  24025. class ConfigValidator
  24026. {
  24027. private $io;
  24028. public function __construct(IOInterface $io)
  24029. {
  24030. $this->io = $io;
  24031. }
  24032. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  24033. {
  24034. $errors = array();
  24035. $publishErrors = array();
  24036. $warnings = array();
  24037. $laxValid = false;
  24038. try {
  24039. $json = new JsonFile($file, null, $this->io);
  24040. $manifest = $json->read();
  24041. $json->validateSchema(JsonFile::LAX_SCHEMA);
  24042. $laxValid = true;
  24043. $json->validateSchema();
  24044. } catch (JsonValidationException $e) {
  24045. foreach ($e->getErrors() as $message) {
  24046. if ($laxValid) {
  24047. $publishErrors[] = $message;
  24048. } else {
  24049. $errors[] = $message;
  24050. }
  24051. }
  24052. } catch (\Exception $e) {
  24053. $errors[] = $e->getMessage();
  24054. return array($errors, $publishErrors, $warnings);
  24055. }
  24056. if (empty($manifest['license'])) {
  24057. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  24058. } else {
  24059. $licenses = (array) $manifest['license'];
  24060. foreach ($licenses as $key => $license) {
  24061. if ('proprietary' === $license) {
  24062. unset($licenses[$key]);
  24063. }
  24064. }
  24065. $licenseValidator = new SpdxLicenses();
  24066. foreach ($licenses as $license) {
  24067. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  24068. if ($spdxLicense && $spdxLicense[3]) {
  24069. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  24070. $warnings[] = sprintf(
  24071. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  24072. $license
  24073. );
  24074. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  24075. $warnings[] = sprintf(
  24076. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  24077. $license
  24078. );
  24079. } else {
  24080. $warnings[] = sprintf(
  24081. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  24082. $license
  24083. );
  24084. }
  24085. }
  24086. }
  24087. }
  24088. if (isset($manifest['version'])) {
  24089. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  24090. }
  24091. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  24092. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  24093. $suggestName = strtolower($suggestName);
  24094. $publishErrors[] = sprintf(
  24095. '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.',
  24096. $manifest['name'],
  24097. $suggestName
  24098. );
  24099. }
  24100. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  24101. $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.";
  24102. }
  24103. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  24104. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  24105. if (!empty($requireOverrides)) {
  24106. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  24107. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  24108. }
  24109. }
  24110. $require = isset($manifest['require']) ? $manifest['require'] : array();
  24111. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  24112. $packages = array_merge($require, $requireDev);
  24113. foreach ($packages as $package => $version) {
  24114. if (preg_match('/#/', $version) === 1) {
  24115. $warnings[] = sprintf(
  24116. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  24117. $package
  24118. );
  24119. }
  24120. }
  24121. $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();
  24122. $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();
  24123. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  24124. if (!array_key_exists($scriptName, $scripts)) {
  24125. $warnings[] = sprintf(
  24126. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  24127. $scriptName
  24128. );
  24129. }
  24130. }
  24131. if (isset($manifest['autoload']['psr-0'][''])) {
  24132. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  24133. }
  24134. if (isset($manifest['autoload']['psr-4'][''])) {
  24135. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  24136. }
  24137. try {
  24138. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  24139. if (!isset($manifest['version'])) {
  24140. $manifest['version'] = '1.0.0';
  24141. }
  24142. if (!isset($manifest['name'])) {
  24143. $manifest['name'] = 'dummy/dummy';
  24144. }
  24145. $loader->load($manifest);
  24146. } catch (InvalidPackageException $e) {
  24147. $errors = array_merge($errors, $e->getErrors());
  24148. }
  24149. $warnings = array_merge($warnings, $loader->getWarnings());
  24150. return array($errors, $publishErrors, $warnings);
  24151. }
  24152. }
  24153. <?php
  24154. namespace Composer\Util;
  24155. use Composer\IO\IOInterface;
  24156. class ErrorHandler
  24157. {
  24158. private static $io;
  24159. public static function handle($level, $message, $file, $line)
  24160. {
  24161. if (!(error_reporting() & $level)) {
  24162. return;
  24163. }
  24164. if (ini_get('xdebug.scream')) {
  24165. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  24166. "\na legitimately suppressed error that you were not supposed to see.";
  24167. }
  24168. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  24169. throw new \ErrorException($message, 0, $level, $file, $line);
  24170. }
  24171. if (self::$io) {
  24172. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  24173. if (self::$io->isVerbose()) {
  24174. self::$io->writeError('<warning>Stack trace:</warning>');
  24175. self::$io->writeError(array_filter(array_map(function ($a) {
  24176. if (isset($a['line'], $a['file'])) {
  24177. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  24178. }
  24179. return null;
  24180. }, array_slice(debug_backtrace(), 2))));
  24181. }
  24182. }
  24183. }
  24184. public static function register(IOInterface $io = null)
  24185. {
  24186. set_error_handler(array(__CLASS__, 'handle'));
  24187. error_reporting(E_ALL | E_STRICT);
  24188. self::$io = $io;
  24189. }
  24190. }
  24191. <?php
  24192. namespace Composer\Util;
  24193. use RecursiveDirectoryIterator;
  24194. use RecursiveIteratorIterator;
  24195. use Symfony\Component\Filesystem\Exception\IOException;
  24196. use Symfony\Component\Finder\Finder;
  24197. class Filesystem
  24198. {
  24199. private $processExecutor;
  24200. public function __construct(ProcessExecutor $executor = null)
  24201. {
  24202. $this->processExecutor = $executor ?: new ProcessExecutor();
  24203. }
  24204. public function remove($file)
  24205. {
  24206. if (is_dir($file)) {
  24207. return $this->removeDirectory($file);
  24208. }
  24209. if (file_exists($file)) {
  24210. return $this->unlink($file);
  24211. }
  24212. return false;
  24213. }
  24214. public function isDirEmpty($dir)
  24215. {
  24216. $finder = Finder::create()
  24217. ->ignoreVCS(false)
  24218. ->ignoreDotFiles(false)
  24219. ->depth(0)
  24220. ->in($dir);
  24221. return count($finder) === 0;
  24222. }
  24223. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  24224. {
  24225. if (file_exists($dir) && is_link($dir)) {
  24226. $this->unlink($dir);
  24227. }
  24228. if ($ensureDirectoryExists) {
  24229. $this->ensureDirectoryExists($dir);
  24230. }
  24231. if (is_dir($dir)) {
  24232. $finder = Finder::create()
  24233. ->ignoreVCS(false)
  24234. ->ignoreDotFiles(false)
  24235. ->depth(0)
  24236. ->in($dir);
  24237. foreach ($finder as $path) {
  24238. $this->remove((string) $path);
  24239. }
  24240. }
  24241. }
  24242. public function removeDirectory($directory)
  24243. {
  24244. if ($this->isSymlinkedDirectory($directory)) {
  24245. return $this->unlinkSymlinkedDirectory($directory);
  24246. }
  24247. if ($this->isJunction($directory)) {
  24248. return $this->removeJunction($directory);
  24249. }
  24250. if (!file_exists($directory) || !is_dir($directory)) {
  24251. return true;
  24252. }
  24253. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  24254. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  24255. }
  24256. if (!function_exists('proc_open')) {
  24257. return $this->removeDirectoryPhp($directory);
  24258. }
  24259. if (Platform::isWindows()) {
  24260. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  24261. } else {
  24262. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  24263. }
  24264. $result = $this->getProcess()->execute($cmd, $output) === 0;
  24265. clearstatcache();
  24266. if ($result && !file_exists($directory)) {
  24267. return true;
  24268. }
  24269. return $this->removeDirectoryPhp($directory);
  24270. }
  24271. public function removeDirectoryPhp($directory)
  24272. {
  24273. try {
  24274. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24275. } catch (\UnexpectedValueException $e) {
  24276. clearstatcache();
  24277. usleep(100000);
  24278. if (!is_dir($directory)) {
  24279. return true;
  24280. }
  24281. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24282. }
  24283. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  24284. foreach ($ri as $file) {
  24285. if ($file->isDir()) {
  24286. $this->rmdir($file->getPathname());
  24287. } else {
  24288. $this->unlink($file->getPathname());
  24289. }
  24290. }
  24291. return $this->rmdir($directory);
  24292. }
  24293. public function ensureDirectoryExists($directory)
  24294. {
  24295. if (!is_dir($directory)) {
  24296. if (file_exists($directory)) {
  24297. throw new \RuntimeException(
  24298. $directory.' exists and is not a directory.'
  24299. );
  24300. }
  24301. if (!@mkdir($directory, 0777, true)) {
  24302. throw new \RuntimeException(
  24303. $directory.' does not exist and could not be created.'
  24304. );
  24305. }
  24306. }
  24307. }
  24308. public function unlink($path)
  24309. {
  24310. if (!@$this->unlinkImplementation($path)) {
  24311. if (!Platform::isWindows() || (usleep(350000) && !@$this->unlinkImplementation($path))) {
  24312. $error = error_get_last();
  24313. $message = 'Could not delete '.$path.': ' . @$error['message'];
  24314. if (Platform::isWindows()) {
  24315. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  24316. }
  24317. throw new \RuntimeException($message);
  24318. }
  24319. }
  24320. return true;
  24321. }
  24322. public function rmdir($path)
  24323. {
  24324. if (!@rmdir($path)) {
  24325. if (!Platform::isWindows() || (usleep(350000) && !@rmdir($path))) {
  24326. $error = error_get_last();
  24327. $message = 'Could not delete '.$path.': ' . @$error['message'];
  24328. if (Platform::isWindows()) {
  24329. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  24330. }
  24331. throw new \RuntimeException($message);
  24332. }
  24333. }
  24334. return true;
  24335. }
  24336. public function copyThenRemove($source, $target)
  24337. {
  24338. $this->copy($source, $target);
  24339. if (!is_dir($source)) {
  24340. $this->unlink($source);
  24341. return;
  24342. }
  24343. $this->removeDirectoryPhp($source);
  24344. }
  24345. public function copy($source, $target)
  24346. {
  24347. if (!is_dir($source)) {
  24348. return copy($source, $target);
  24349. }
  24350. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  24351. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  24352. $this->ensureDirectoryExists($target);
  24353. $result = true;
  24354. foreach ($ri as $file) {
  24355. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  24356. if ($file->isDir()) {
  24357. $this->ensureDirectoryExists($targetPath);
  24358. } else {
  24359. $result = $result && copy($file->getPathname(), $targetPath);
  24360. }
  24361. }
  24362. return $result;
  24363. }
  24364. public function rename($source, $target)
  24365. {
  24366. if (true === @rename($source, $target)) {
  24367. return;
  24368. }
  24369. if (!function_exists('proc_open')) {
  24370. return $this->copyThenRemove($source, $target);
  24371. }
  24372. if (Platform::isWindows()) {
  24373. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  24374. $result = $this->processExecutor->execute($command, $output);
  24375. clearstatcache();
  24376. if (0 === $result) {
  24377. $this->remove($source);
  24378. return;
  24379. }
  24380. } else {
  24381. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  24382. $result = $this->processExecutor->execute($command, $output);
  24383. clearstatcache();
  24384. if (0 === $result) {
  24385. return;
  24386. }
  24387. }
  24388. return $this->copyThenRemove($source, $target);
  24389. }
  24390. public function findShortestPath($from, $to, $directories = false)
  24391. {
  24392. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  24393. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  24394. }
  24395. $from = lcfirst($this->normalizePath($from));
  24396. $to = lcfirst($this->normalizePath($to));
  24397. if ($directories) {
  24398. $from = rtrim($from, '/') . '/dummy_file';
  24399. }
  24400. if (dirname($from) === dirname($to)) {
  24401. return './'.basename($to);
  24402. }
  24403. $commonPath = $to;
  24404. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  24405. $commonPath = strtr(dirname($commonPath), '\\', '/');
  24406. }
  24407. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  24408. return $to;
  24409. }
  24410. $commonPath = rtrim($commonPath, '/') . '/';
  24411. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  24412. $commonPathCode = str_repeat('../', $sourcePathDepth);
  24413. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  24414. }
  24415. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  24416. {
  24417. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  24418. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  24419. }
  24420. $from = lcfirst($this->normalizePath($from));
  24421. $to = lcfirst($this->normalizePath($to));
  24422. if ($from === $to) {
  24423. return $directories ? '__DIR__' : '__FILE__';
  24424. }
  24425. $commonPath = $to;
  24426. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  24427. $commonPath = strtr(dirname($commonPath), '\\', '/');
  24428. }
  24429. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  24430. return var_export($to, true);
  24431. }
  24432. $commonPath = rtrim($commonPath, '/') . '/';
  24433. if (strpos($to, $from.'/') === 0) {
  24434. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  24435. }
  24436. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  24437. if ($staticCode) {
  24438. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  24439. } else {
  24440. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  24441. }
  24442. $relTarget = substr($to, strlen($commonPath));
  24443. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  24444. }
  24445. public function isAbsolutePath($path)
  24446. {
  24447. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
  24448. }
  24449. public function size($path)
  24450. {
  24451. if (!file_exists($path)) {
  24452. throw new \RuntimeException("$path does not exist.");
  24453. }
  24454. if (is_dir($path)) {
  24455. return $this->directorySize($path);
  24456. }
  24457. return filesize($path);
  24458. }
  24459. public function normalizePath($path)
  24460. {
  24461. $parts = array();
  24462. $path = strtr($path, '\\', '/');
  24463. $prefix = '';
  24464. $absolute = false;
  24465. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  24466. $prefix = $match[1];
  24467. $path = substr($path, strlen($prefix));
  24468. }
  24469. if (substr($path, 0, 1) === '/') {
  24470. $absolute = true;
  24471. $path = substr($path, 1);
  24472. }
  24473. $up = false;
  24474. foreach (explode('/', $path) as $chunk) {
  24475. if ('..' === $chunk && ($absolute || $up)) {
  24476. array_pop($parts);
  24477. $up = !(empty($parts) || '..' === end($parts));
  24478. } elseif ('.' !== $chunk && '' !== $chunk) {
  24479. $parts[] = $chunk;
  24480. $up = '..' !== $chunk;
  24481. }
  24482. }
  24483. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  24484. }
  24485. public static function isLocalPath($path)
  24486. {
  24487. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  24488. }
  24489. public static function getPlatformPath($path)
  24490. {
  24491. if (Platform::isWindows()) {
  24492. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  24493. }
  24494. return preg_replace('{^file://}i', '', $path);
  24495. }
  24496. protected function directorySize($directory)
  24497. {
  24498. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24499. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  24500. $size = 0;
  24501. foreach ($ri as $file) {
  24502. if ($file->isFile()) {
  24503. $size += $file->getSize();
  24504. }
  24505. }
  24506. return $size;
  24507. }
  24508. protected function getProcess()
  24509. {
  24510. return new ProcessExecutor;
  24511. }
  24512. private function unlinkImplementation($path)
  24513. {
  24514. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  24515. return rmdir($path);
  24516. }
  24517. return unlink($path);
  24518. }
  24519. public function relativeSymlink($target, $link)
  24520. {
  24521. $cwd = getcwd();
  24522. $relativePath = $this->findShortestPath($link, $target);
  24523. chdir(dirname($link));
  24524. $result = @symlink($relativePath, $link);
  24525. chdir($cwd);
  24526. return (bool) $result;
  24527. }
  24528. public function isSymlinkedDirectory($directory)
  24529. {
  24530. if (!is_dir($directory)) {
  24531. return false;
  24532. }
  24533. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  24534. return is_link($resolved);
  24535. }
  24536. private function unlinkSymlinkedDirectory($directory)
  24537. {
  24538. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  24539. return $this->unlink($resolved);
  24540. }
  24541. private function resolveSymlinkedDirectorySymlink($pathname)
  24542. {
  24543. if (!is_dir($pathname)) {
  24544. return $pathname;
  24545. }
  24546. $resolved = rtrim($pathname, '/');
  24547. if (!strlen($resolved)) {
  24548. return $pathname;
  24549. }
  24550. return $resolved;
  24551. }
  24552. public function junction($target, $junction)
  24553. {
  24554. if (!Platform::isWindows()) {
  24555. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  24556. }
  24557. if (!is_dir($target)) {
  24558. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  24559. }
  24560. $cmd = sprintf('mklink /J %s %s',
  24561. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  24562. ProcessExecutor::escape(realpath($target)));
  24563. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  24564. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  24565. }
  24566. clearstatcache(true, $junction);
  24567. }
  24568. public function isJunction($junction)
  24569. {
  24570. if (!Platform::isWindows()) {
  24571. return false;
  24572. }
  24573. if (!is_dir($junction) || is_link($junction)) {
  24574. return false;
  24575. }
  24576. clearstatcache(true, $junction);
  24577. clearstatcache(false);
  24578. $stat = lstat($junction);
  24579. return !($stat['mode'] & 0xC000);
  24580. }
  24581. public function removeJunction($junction)
  24582. {
  24583. if (!Platform::isWindows()) {
  24584. return false;
  24585. }
  24586. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  24587. if (!$this->isJunction($junction)) {
  24588. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  24589. }
  24590. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction));
  24591. clearstatcache(true, $junction);
  24592. return ($this->getProcess()->execute($cmd, $output) === 0);
  24593. }
  24594. }
  24595. <?php
  24596. namespace Composer\Util;
  24597. use Composer\Config;
  24598. use Composer\IO\IOInterface;
  24599. class Git
  24600. {
  24601. private static $version;
  24602. protected $io;
  24603. protected $config;
  24604. protected $process;
  24605. protected $filesystem;
  24606. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  24607. {
  24608. $this->io = $io;
  24609. $this->config = $config;
  24610. $this->process = $process;
  24611. $this->filesystem = $fs;
  24612. }
  24613. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  24614. {
  24615. $this->config->prohibitUrlByConfig($url, $this->io);
  24616. if ($initialClone) {
  24617. $origCwd = $cwd;
  24618. $cwd = null;
  24619. }
  24620. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  24621. 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.');
  24622. }
  24623. if (!$initialClone) {
  24624. $this->process->execute('git remote -v', $output, $cwd);
  24625. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
  24626. $this->io->setAuthentication($match[3], urldecode($match[1]), urldecode($match[2]));
  24627. }
  24628. }
  24629. $protocols = $this->config->get('github-protocols');
  24630. if (!is_array($protocols)) {
  24631. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  24632. }
  24633. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  24634. $messages = array();
  24635. foreach ($protocols as $protocol) {
  24636. if ('ssh' === $protocol) {
  24637. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  24638. } else {
  24639. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  24640. }
  24641. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  24642. return;
  24643. }
  24644. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  24645. if ($initialClone) {
  24646. $this->filesystem->removeDirectory($origCwd);
  24647. }
  24648. }
  24649. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  24650. }
  24651. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  24652. $command = call_user_func($commandCallable, $url);
  24653. $auth = null;
  24654. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  24655. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)) {
  24656. if (!$this->io->hasAuthentication($match[1])) {
  24657. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  24658. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  24659. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  24660. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  24661. }
  24662. }
  24663. if ($this->io->hasAuthentication($match[1])) {
  24664. $auth = $this->io->getAuthentication($match[1]);
  24665. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  24666. $command = call_user_func($commandCallable, $authUrl);
  24667. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24668. return;
  24669. }
  24670. }
  24671. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  24672. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  24673. if (!$this->io->hasAuthentication($match[1])) {
  24674. $message = 'Enter your Bitbucket credentials to access private repos';
  24675. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  24676. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  24677. $accessToken = $bitbucketUtil->getToken();
  24678. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  24679. }
  24680. } else {
  24681. $auth = $this->io->getAuthentication($match[1]);
  24682. if ($auth['username'] !== 'x-token-auth') {
  24683. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  24684. if (! empty($accessToken)) {
  24685. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  24686. }
  24687. }
  24688. }
  24689. if ($this->io->hasAuthentication($match[1])) {
  24690. $auth = $this->io->getAuthentication($match[1]);
  24691. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  24692. $command = call_user_func($commandCallable, $authUrl);
  24693. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24694. return;
  24695. }
  24696. } else {
  24697. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  24698. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  24699. $command = call_user_func($commandCallable, $sshUrl);
  24700. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24701. return;
  24702. }
  24703. }
  24704. } elseif ($this->isAuthenticationFailure($url, $match)) {
  24705. if (strpos($match[2], '@')) {
  24706. list($authParts, $match[2]) = explode('@', $match[2], 2);
  24707. }
  24708. $storeAuth = false;
  24709. if ($this->io->hasAuthentication($match[2])) {
  24710. $auth = $this->io->getAuthentication($match[2]);
  24711. } elseif ($this->io->isInteractive()) {
  24712. $defaultUsername = null;
  24713. if (isset($authParts) && $authParts) {
  24714. if (false !== strpos($authParts, ':')) {
  24715. list($defaultUsername, ) = explode(':', $authParts, 2);
  24716. } else {
  24717. $defaultUsername = $authParts;
  24718. }
  24719. }
  24720. $this->io->writeError(' Authentication required (<info>' . parse_url($url, PHP_URL_HOST) . '</info>):');
  24721. $auth = array(
  24722. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  24723. 'password' => $this->io->askAndHideAnswer(' Password: '),
  24724. );
  24725. $storeAuth = $this->config->get('store-auths');
  24726. }
  24727. if ($auth) {
  24728. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  24729. $command = call_user_func($commandCallable, $authUrl);
  24730. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24731. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  24732. $authHelper = new AuthHelper($this->io, $this->config);
  24733. $authHelper->storeAuth($match[2], $storeAuth);
  24734. return;
  24735. }
  24736. }
  24737. }
  24738. if ($initialClone) {
  24739. $this->filesystem->removeDirectory($origCwd);
  24740. }
  24741. $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url);
  24742. }
  24743. }
  24744. public function syncMirror($url, $dir)
  24745. {
  24746. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  24747. try {
  24748. $commandCallable = function ($url) {
  24749. return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
  24750. };
  24751. $this->runCommand($commandCallable, $url, $dir);
  24752. } catch (\Exception $e) {
  24753. return false;
  24754. }
  24755. return true;
  24756. }
  24757. $this->filesystem->removeDirectory($dir);
  24758. $commandCallable = function ($url) use ($dir) {
  24759. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  24760. };
  24761. $this->runCommand($commandCallable, $url, $dir, true);
  24762. return true;
  24763. }
  24764. public function fetchRefOrSyncMirror($url, $dir, $ref)
  24765. {
  24766. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  24767. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  24768. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $output, $dir);
  24769. if ($exitCode === 0) {
  24770. return true;
  24771. }
  24772. }
  24773. $this->syncMirror($url, $dir);
  24774. return false;
  24775. }
  24776. private function isAuthenticationFailure($url, &$match)
  24777. {
  24778. if (!preg_match('{(https?://)([^/]+)(.*)$}i', $url, $match)) {
  24779. return false;
  24780. }
  24781. $authFailures = array(
  24782. 'fatal: Authentication failed',
  24783. 'remote error: Invalid username or password.',
  24784. 'error: 401 Unauthorized',
  24785. 'fatal: unable to access',
  24786. );
  24787. foreach ($authFailures as $authFailure) {
  24788. if (strpos($this->process->getErrorOutput(), $authFailure) !== false) {
  24789. return true;
  24790. }
  24791. }
  24792. return false;
  24793. }
  24794. public static function cleanEnv()
  24795. {
  24796. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  24797. 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');
  24798. }
  24799. if (getenv('GIT_ASKPASS') !== 'echo') {
  24800. putenv('GIT_ASKPASS=echo');
  24801. unset($_SERVER['GIT_ASKPASS']);
  24802. }
  24803. if (getenv('GIT_DIR')) {
  24804. putenv('GIT_DIR');
  24805. unset($_SERVER['GIT_DIR']);
  24806. }
  24807. if (getenv('GIT_WORK_TREE')) {
  24808. putenv('GIT_WORK_TREE');
  24809. unset($_SERVER['GIT_WORK_TREE']);
  24810. }
  24811. if (getenv('LANGUAGE') !== 'C') {
  24812. putenv('LANGUAGE=C');
  24813. }
  24814. putenv("DYLD_LIBRARY_PATH");
  24815. unset($_SERVER['DYLD_LIBRARY_PATH']);
  24816. }
  24817. public static function getGitHubDomainsRegex(Config $config)
  24818. {
  24819. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  24820. }
  24821. public static function sanitizeUrl($message)
  24822. {
  24823. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  24824. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  24825. return '://***:***@';
  24826. }
  24827. return '://' . $m[1] . ':***@';
  24828. }, $message);
  24829. }
  24830. private function throwException($message, $url)
  24831. {
  24832. clearstatcache();
  24833. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  24834. 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()));
  24835. }
  24836. throw new \RuntimeException(self::sanitizeUrl($message));
  24837. }
  24838. public function getVersion()
  24839. {
  24840. if (isset(self::$version)) {
  24841. return self::$version;
  24842. }
  24843. if (0 !== $this->process->execute('git --version', $output)) {
  24844. return;
  24845. }
  24846. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  24847. return self::$version = $matches[1];
  24848. }
  24849. }
  24850. }
  24851. <?php
  24852. namespace Composer\Util;
  24853. use Composer\Factory;
  24854. use Composer\IO\IOInterface;
  24855. use Composer\Config;
  24856. use Composer\Downloader\TransportException;
  24857. class GitHub
  24858. {
  24859. protected $io;
  24860. protected $config;
  24861. protected $process;
  24862. protected $remoteFilesystem;
  24863. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24864. {
  24865. $this->io = $io;
  24866. $this->config = $config;
  24867. $this->process = $process ?: new ProcessExecutor;
  24868. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24869. }
  24870. public function authorizeOAuth($originUrl)
  24871. {
  24872. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  24873. return false;
  24874. }
  24875. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  24876. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  24877. return true;
  24878. }
  24879. return false;
  24880. }
  24881. public function authorizeOAuthInteractively($originUrl, $message = null)
  24882. {
  24883. if ($message) {
  24884. $this->io->writeError($message);
  24885. }
  24886. $note = 'Composer';
  24887. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  24888. $note .= ' on ' . trim($output);
  24889. }
  24890. $note .= ' ' . date('Y-m-d Hi');
  24891. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  24892. $this->io->writeError(sprintf('Head to %s', $url));
  24893. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  24894. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  24895. if (!$token) {
  24896. $this->io->writeError('<warning>No token given, aborting.</warning>');
  24897. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  24898. return false;
  24899. }
  24900. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  24901. try {
  24902. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  24903. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  24904. 'retry-auth-failure' => false,
  24905. ));
  24906. } catch (TransportException $e) {
  24907. if (in_array($e->getCode(), array(403, 401))) {
  24908. $this->io->writeError('<error>Invalid token provided.</error>');
  24909. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  24910. return false;
  24911. }
  24912. throw $e;
  24913. }
  24914. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  24915. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  24916. $this->io->writeError('<info>Token stored successfully.</info>');
  24917. return true;
  24918. }
  24919. }
  24920. <?php
  24921. namespace Composer\Util;
  24922. use Composer\IO\IOInterface;
  24923. use Composer\Config;
  24924. use Composer\Factory;
  24925. use Composer\Downloader\TransportException;
  24926. use Composer\Json\JsonFile;
  24927. class GitLab
  24928. {
  24929. protected $io;
  24930. protected $config;
  24931. protected $process;
  24932. protected $remoteFilesystem;
  24933. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24934. {
  24935. $this->io = $io;
  24936. $this->config = $config;
  24937. $this->process = $process ?: new ProcessExecutor();
  24938. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24939. }
  24940. public function authorizeOAuth($originUrl)
  24941. {
  24942. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  24943. return false;
  24944. }
  24945. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  24946. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  24947. return true;
  24948. }
  24949. $authTokens = $this->config->get('gitlab-token');
  24950. if (isset($authTokens[$originUrl])) {
  24951. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  24952. return true;
  24953. }
  24954. return false;
  24955. }
  24956. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  24957. {
  24958. if ($message) {
  24959. $this->io->writeError($message);
  24960. }
  24961. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  24962. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  24963. $attemptCounter = 0;
  24964. while ($attemptCounter++ < 5) {
  24965. try {
  24966. $response = $this->createToken($scheme, $originUrl);
  24967. } catch (TransportException $e) {
  24968. if (in_array($e->getCode(), array(403, 401))) {
  24969. if (401 === $e->getCode()) {
  24970. $this->io->writeError('Bad credentials.');
  24971. } else {
  24972. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  24973. }
  24974. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  24975. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  24976. continue;
  24977. }
  24978. throw $e;
  24979. }
  24980. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  24981. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  24982. return true;
  24983. }
  24984. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  24985. }
  24986. private function createToken($scheme, $originUrl)
  24987. {
  24988. $username = $this->io->ask('Username: ');
  24989. $password = $this->io->askAndHideAnswer('Password: ');
  24990. $headers = array('Content-Type: application/x-www-form-urlencoded');
  24991. $apiUrl = $originUrl;
  24992. $data = http_build_query(array(
  24993. 'username' => $username,
  24994. 'password' => $password,
  24995. 'grant_type' => 'password',
  24996. ), null, '&');
  24997. $options = array(
  24998. 'retry-auth-failure' => false,
  24999. 'http' => array(
  25000. 'method' => 'POST',
  25001. 'header' => $headers,
  25002. 'content' => $data,
  25003. ),
  25004. );
  25005. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  25006. $this->io->writeError('Token successfully created');
  25007. return JsonFile::parseJson($json);
  25008. }
  25009. }
  25010. <?php
  25011. namespace Composer\Util;
  25012. class IniHelper
  25013. {
  25014. const ENV_ORIGINAL = 'COMPOSER_ORIGINAL_INIS';
  25015. public static function getAll()
  25016. {
  25017. $env = getenv(self::ENV_ORIGINAL);
  25018. if (false !== $env) {
  25019. return explode(PATH_SEPARATOR, $env);
  25020. }
  25021. $paths = array(strval(php_ini_loaded_file()));
  25022. if ($scanned = php_ini_scanned_files()) {
  25023. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  25024. }
  25025. return $paths;
  25026. }
  25027. public static function getMessage()
  25028. {
  25029. $paths = self::getAll();
  25030. if (empty($paths[0])) {
  25031. array_shift($paths);
  25032. }
  25033. $ini = array_shift($paths);
  25034. if (empty($ini)) {
  25035. return 'A php.ini file does not exist. You will have to create one.';
  25036. }
  25037. if (!empty($paths)) {
  25038. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  25039. }
  25040. return 'The php.ini used by your command-line PHP is: '.$ini;
  25041. }
  25042. }
  25043. <?php
  25044. namespace Composer\Util;
  25045. class NoProxyPattern
  25046. {
  25047. protected $rules = array();
  25048. public function __construct($pattern)
  25049. {
  25050. $this->rules = preg_split("/[\s,]+/", $pattern);
  25051. }
  25052. public function test($url)
  25053. {
  25054. $host = parse_url($url, PHP_URL_HOST);
  25055. $port = parse_url($url, PHP_URL_PORT);
  25056. if (empty($port)) {
  25057. switch (parse_url($url, PHP_URL_SCHEME)) {
  25058. case 'http':
  25059. $port = 80;
  25060. break;
  25061. case 'https':
  25062. $port = 443;
  25063. break;
  25064. }
  25065. }
  25066. foreach ($this->rules as $rule) {
  25067. if ($rule == '*') {
  25068. return true;
  25069. }
  25070. $match = false;
  25071. list($ruleHost) = explode(':', $rule);
  25072. list($base) = explode('/', $ruleHost);
  25073. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  25074. if (!isset($ip)) {
  25075. $ip = gethostbyname($host);
  25076. }
  25077. if (strpos($ruleHost, '/') === false) {
  25078. $match = $ip === $ruleHost;
  25079. } else {
  25080. if ($ip === $host) {
  25081. $match = false;
  25082. } else {
  25083. $match = self::inCIDRBlock($ruleHost, $ip);
  25084. }
  25085. }
  25086. } else {
  25087. $haystack = '.' . trim($host, '.') . '.';
  25088. $needle = '.'. trim($ruleHost, '.') .'.';
  25089. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  25090. }
  25091. if ($match && strpos($rule, ':') !== false) {
  25092. list(, $rulePort) = explode(':', $rule);
  25093. if (!empty($rulePort) && $port != $rulePort) {
  25094. $match = false;
  25095. }
  25096. }
  25097. if ($match) {
  25098. return true;
  25099. }
  25100. }
  25101. return false;
  25102. }
  25103. private static function inCIDRBlock($cidr, $ip)
  25104. {
  25105. list($base, $bits) = explode('/', $cidr);
  25106. list($a, $b, $c, $d) = explode('.', $base);
  25107. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  25108. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  25109. $low = $i & $mask;
  25110. $high = $i | (~$mask & 0xFFFFFFFF);
  25111. list($a, $b, $c, $d) = explode('.', $ip);
  25112. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  25113. return $check >= $low && $check <= $high;
  25114. }
  25115. }
  25116. <?php
  25117. namespace Composer\Util;
  25118. use Composer\IO\IOInterface;
  25119. use Symfony\Component\Process\Process;
  25120. class Perforce
  25121. {
  25122. protected $path;
  25123. protected $p4Depot;
  25124. protected $p4Client;
  25125. protected $p4User;
  25126. protected $p4Password;
  25127. protected $p4Port;
  25128. protected $p4Stream;
  25129. protected $p4ClientSpec;
  25130. protected $p4DepotType;
  25131. protected $p4Branch;
  25132. protected $process;
  25133. protected $uniquePerforceClientName;
  25134. protected $windowsFlag;
  25135. protected $commandResult;
  25136. protected $io;
  25137. protected $filesystem;
  25138. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  25139. {
  25140. $this->windowsFlag = $isWindows;
  25141. $this->p4Port = $port;
  25142. $this->initializePath($path);
  25143. $this->process = $process;
  25144. $this->initialize($repoConfig);
  25145. $this->io = $io;
  25146. }
  25147. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  25148. {
  25149. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  25150. }
  25151. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  25152. {
  25153. $output = null;
  25154. return 0 === $processExecutor->execute('p4 -p ' . $url . ' info -s', $output);
  25155. }
  25156. public function initialize($repoConfig)
  25157. {
  25158. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  25159. if (!$repoConfig) {
  25160. return;
  25161. }
  25162. if (isset($repoConfig['unique_perforce_client_name'])) {
  25163. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  25164. }
  25165. if (isset($repoConfig['depot'])) {
  25166. $this->p4Depot = $repoConfig['depot'];
  25167. }
  25168. if (isset($repoConfig['branch'])) {
  25169. $this->p4Branch = $repoConfig['branch'];
  25170. }
  25171. if (isset($repoConfig['p4user'])) {
  25172. $this->p4User = $repoConfig['p4user'];
  25173. } else {
  25174. $this->p4User = $this->getP4variable('P4USER');
  25175. }
  25176. if (isset($repoConfig['p4password'])) {
  25177. $this->p4Password = $repoConfig['p4password'];
  25178. }
  25179. }
  25180. public function initializeDepotAndBranch($depot, $branch)
  25181. {
  25182. if (isset($depot)) {
  25183. $this->p4Depot = $depot;
  25184. }
  25185. if (isset($branch)) {
  25186. $this->p4Branch = $branch;
  25187. }
  25188. }
  25189. public function generateUniquePerforceClientName()
  25190. {
  25191. return gethostname() . "_" . time();
  25192. }
  25193. public function cleanupClientSpec()
  25194. {
  25195. $client = $this->getClient();
  25196. $task = 'client -d ' . $client;
  25197. $useP4Client = false;
  25198. $command = $this->generateP4Command($task, $useP4Client);
  25199. $this->executeCommand($command);
  25200. $clientSpec = $this->getP4ClientSpec();
  25201. $fileSystem = $this->getFilesystem();
  25202. $fileSystem->remove($clientSpec);
  25203. }
  25204. protected function executeCommand($command)
  25205. {
  25206. $this->commandResult = '';
  25207. return $this->process->execute($command, $this->commandResult);
  25208. }
  25209. public function getClient()
  25210. {
  25211. if (!isset($this->p4Client)) {
  25212. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  25213. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  25214. }
  25215. return $this->p4Client;
  25216. }
  25217. protected function getPath()
  25218. {
  25219. return $this->path;
  25220. }
  25221. public function initializePath($path)
  25222. {
  25223. $this->path = $path;
  25224. $fs = $this->getFilesystem();
  25225. $fs->ensureDirectoryExists($path);
  25226. }
  25227. protected function getPort()
  25228. {
  25229. return $this->p4Port;
  25230. }
  25231. public function setStream($stream)
  25232. {
  25233. $this->p4Stream = $stream;
  25234. $index = strrpos($stream, '/');
  25235. if ($index > 2) {
  25236. $this->p4DepotType = 'stream';
  25237. }
  25238. }
  25239. public function isStream()
  25240. {
  25241. return (strcmp($this->p4DepotType, 'stream') === 0);
  25242. }
  25243. public function getStream()
  25244. {
  25245. if (!isset($this->p4Stream)) {
  25246. if ($this->isStream()) {
  25247. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  25248. } else {
  25249. $this->p4Stream = '//' . $this->p4Depot;
  25250. }
  25251. }
  25252. return $this->p4Stream;
  25253. }
  25254. public function getStreamWithoutLabel($stream)
  25255. {
  25256. $index = strpos($stream, '@');
  25257. if ($index === false) {
  25258. return $stream;
  25259. }
  25260. return substr($stream, 0, $index);
  25261. }
  25262. public function getP4ClientSpec()
  25263. {
  25264. return $this->path . '/' . $this->getClient() . '.p4.spec';
  25265. }
  25266. public function getUser()
  25267. {
  25268. return $this->p4User;
  25269. }
  25270. public function setUser($user)
  25271. {
  25272. $this->p4User = $user;
  25273. }
  25274. public function queryP4User()
  25275. {
  25276. $this->getUser();
  25277. if (strlen($this->p4User) > 0) {
  25278. return;
  25279. }
  25280. $this->p4User = $this->getP4variable('P4USER');
  25281. if (strlen($this->p4User) > 0) {
  25282. return;
  25283. }
  25284. $this->p4User = $this->io->ask('Enter P4 User:');
  25285. if ($this->windowsFlag) {
  25286. $command = 'p4 set P4USER=' . $this->p4User;
  25287. } else {
  25288. $command = 'export P4USER=' . $this->p4User;
  25289. }
  25290. $this->executeCommand($command);
  25291. }
  25292. protected function getP4variable($name)
  25293. {
  25294. if ($this->windowsFlag) {
  25295. $command = 'p4 set';
  25296. $this->executeCommand($command);
  25297. $result = trim($this->commandResult);
  25298. $resArray = explode(PHP_EOL, $result);
  25299. foreach ($resArray as $line) {
  25300. $fields = explode('=', $line);
  25301. if (strcmp($name, $fields[0]) == 0) {
  25302. $index = strpos($fields[1], ' ');
  25303. if ($index === false) {
  25304. $value = $fields[1];
  25305. } else {
  25306. $value = substr($fields[1], 0, $index);
  25307. }
  25308. $value = trim($value);
  25309. return $value;
  25310. }
  25311. }
  25312. return null;
  25313. }
  25314. $command = 'echo $' . $name;
  25315. $this->executeCommand($command);
  25316. $result = trim($this->commandResult);
  25317. return $result;
  25318. }
  25319. public function queryP4Password()
  25320. {
  25321. if (isset($this->p4Password)) {
  25322. return $this->p4Password;
  25323. }
  25324. $password = $this->getP4variable('P4PASSWD');
  25325. if (strlen($password) <= 0) {
  25326. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  25327. }
  25328. $this->p4Password = $password;
  25329. return $password;
  25330. }
  25331. public function generateP4Command($command, $useClient = true)
  25332. {
  25333. $p4Command = 'p4 ';
  25334. $p4Command = $p4Command . '-u ' . $this->getUser() . ' ';
  25335. if ($useClient) {
  25336. $p4Command = $p4Command . '-c ' . $this->getClient() . ' ';
  25337. }
  25338. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  25339. return $p4Command;
  25340. }
  25341. public function isLoggedIn()
  25342. {
  25343. $command = $this->generateP4Command('login -s', false);
  25344. $exitCode = $this->executeCommand($command);
  25345. if ($exitCode) {
  25346. $errorOutput = $this->process->getErrorOutput();
  25347. $index = strpos($errorOutput, $this->getUser());
  25348. if ($index === false) {
  25349. $index = strpos($errorOutput, 'p4');
  25350. if ($index === false) {
  25351. return false;
  25352. }
  25353. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  25354. }
  25355. throw new \Exception('Invalid user name: ' . $this->getUser());
  25356. }
  25357. return true;
  25358. }
  25359. public function connectClient()
  25360. {
  25361. $p4CreateClientCommand = $this->generateP4Command(
  25362. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  25363. );
  25364. $this->executeCommand($p4CreateClientCommand);
  25365. }
  25366. public function syncCodeBase($sourceReference)
  25367. {
  25368. $prevDir = getcwd();
  25369. chdir($this->path);
  25370. $p4SyncCommand = $this->generateP4Command('sync -f ');
  25371. if (null !== $sourceReference) {
  25372. $p4SyncCommand = $p4SyncCommand . '@' . $sourceReference;
  25373. }
  25374. $this->executeCommand($p4SyncCommand);
  25375. chdir($prevDir);
  25376. }
  25377. public function writeClientSpecToFile($spec)
  25378. {
  25379. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  25380. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  25381. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  25382. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  25383. fwrite($spec, 'Description:' . PHP_EOL);
  25384. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  25385. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  25386. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  25387. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  25388. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  25389. if ($this->isStream()) {
  25390. fwrite($spec, 'Stream:' . PHP_EOL);
  25391. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  25392. } else {
  25393. fwrite(
  25394. $spec,
  25395. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  25396. );
  25397. }
  25398. }
  25399. public function writeP4ClientSpec()
  25400. {
  25401. $clientSpec = $this->getP4ClientSpec();
  25402. $spec = fopen($clientSpec, 'w');
  25403. try {
  25404. $this->writeClientSpecToFile($spec);
  25405. } catch (\Exception $e) {
  25406. fclose($spec);
  25407. throw $e;
  25408. }
  25409. fclose($spec);
  25410. }
  25411. protected function read($pipe, $name)
  25412. {
  25413. if (feof($pipe)) {
  25414. return;
  25415. }
  25416. $line = fgets($pipe);
  25417. while ($line !== false) {
  25418. $line = fgets($pipe);
  25419. }
  25420. return;
  25421. }
  25422. public function windowsLogin($password)
  25423. {
  25424. $command = $this->generateP4Command(' login -a');
  25425. $process = new Process($command, null, null, $password);
  25426. return $process->run();
  25427. }
  25428. public function p4Login()
  25429. {
  25430. $this->queryP4User();
  25431. if (!$this->isLoggedIn()) {
  25432. $password = $this->queryP4Password();
  25433. if ($this->windowsFlag) {
  25434. $this->windowsLogin($password);
  25435. } else {
  25436. $command = 'echo ' . $password . ' | ' . $this->generateP4Command(' login -a', false);
  25437. $exitCode = $this->executeCommand($command);
  25438. $result = trim($this->commandResult);
  25439. if ($exitCode) {
  25440. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  25441. }
  25442. }
  25443. }
  25444. }
  25445. public function getComposerInformation($identifier)
  25446. {
  25447. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  25448. if (!$composerFileContent) {
  25449. return;
  25450. }
  25451. return json_decode($composerFileContent, true);
  25452. }
  25453. public function getFileContent($file, $identifier)
  25454. {
  25455. $path = $this->getFilePath($file, $identifier);
  25456. $command = $this->generateP4Command(' print ' . $path);
  25457. $this->executeCommand($command);
  25458. $result = $this->commandResult;
  25459. if (!trim($result)) {
  25460. return null;
  25461. }
  25462. return $result;
  25463. }
  25464. public function getFilePath($file, $identifier)
  25465. {
  25466. $index = strpos($identifier, '@');
  25467. if ($index === false) {
  25468. $path = $identifier. '/' . $file;
  25469. return $path;
  25470. }
  25471. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  25472. $command = $this->generateP4Command(' files ' . $path, false);
  25473. $this->executeCommand($command);
  25474. $result = $this->commandResult;
  25475. $index2 = strpos($result, 'no such file(s).');
  25476. if ($index2 === false) {
  25477. $index3 = strpos($result, 'change');
  25478. if ($index3 !== false) {
  25479. $phrase = trim(substr($result, $index3));
  25480. $fields = explode(' ', $phrase);
  25481. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  25482. }
  25483. }
  25484. return null;
  25485. }
  25486. public function getBranches()
  25487. {
  25488. $possibleBranches = array();
  25489. if (!$this->isStream()) {
  25490. $possibleBranches[$this->p4Branch] = $this->getStream();
  25491. } else {
  25492. $command = $this->generateP4Command('streams //' . $this->p4Depot . '/...');
  25493. $this->executeCommand($command);
  25494. $result = $this->commandResult;
  25495. $resArray = explode(PHP_EOL, $result);
  25496. foreach ($resArray as $line) {
  25497. $resBits = explode(' ', $line);
  25498. if (count($resBits) > 4) {
  25499. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  25500. $possibleBranches[$branch] = $resBits[1];
  25501. }
  25502. }
  25503. }
  25504. $command = $this->generateP4Command('changes '. $this->getStream() . '/...', false);
  25505. $this->executeCommand($command);
  25506. $result = $this->commandResult;
  25507. $resArray = explode(PHP_EOL, $result);
  25508. $lastCommit = $resArray[0];
  25509. $lastCommitArr = explode(' ', $lastCommit);
  25510. $lastCommitNum = $lastCommitArr[1];
  25511. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  25512. return $branches;
  25513. }
  25514. public function getTags()
  25515. {
  25516. $command = $this->generateP4Command('labels');
  25517. $this->executeCommand($command);
  25518. $result = $this->commandResult;
  25519. $resArray = explode(PHP_EOL, $result);
  25520. $tags = array();
  25521. foreach ($resArray as $line) {
  25522. $index = strpos($line, 'Label');
  25523. if (!($index === false)) {
  25524. $fields = explode(' ', $line);
  25525. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  25526. }
  25527. }
  25528. return $tags;
  25529. }
  25530. public function checkStream()
  25531. {
  25532. $command = $this->generateP4Command('depots', false);
  25533. $this->executeCommand($command);
  25534. $result = $this->commandResult;
  25535. $resArray = explode(PHP_EOL, $result);
  25536. foreach ($resArray as $line) {
  25537. $index = strpos($line, 'Depot');
  25538. if (!($index === false)) {
  25539. $fields = explode(' ', $line);
  25540. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  25541. $this->p4DepotType = $fields[3];
  25542. return $this->isStream();
  25543. }
  25544. }
  25545. }
  25546. return false;
  25547. }
  25548. protected function getChangeList($reference)
  25549. {
  25550. $index = strpos($reference, '@');
  25551. if ($index === false) {
  25552. return null;
  25553. }
  25554. $label = substr($reference, $index);
  25555. $command = $this->generateP4Command(' changes -m1 ' . $label);
  25556. $this->executeCommand($command);
  25557. $changes = $this->commandResult;
  25558. if (strpos($changes, 'Change') !== 0) {
  25559. return null;
  25560. }
  25561. $fields = explode(' ', $changes);
  25562. return $fields[1];
  25563. }
  25564. public function getCommitLogs($fromReference, $toReference)
  25565. {
  25566. $fromChangeList = $this->getChangeList($fromReference);
  25567. if ($fromChangeList === null) {
  25568. return null;
  25569. }
  25570. $toChangeList = $this->getChangeList($toReference);
  25571. if ($toChangeList === null) {
  25572. return null;
  25573. }
  25574. $index = strpos($fromReference, '@');
  25575. $main = substr($fromReference, 0, $index) . '/...';
  25576. $command = $this->generateP4Command('filelog ' . $main . '@' . $fromChangeList. ',' . $toChangeList);
  25577. $this->executeCommand($command);
  25578. return $this->commandResult;
  25579. }
  25580. public function getFilesystem()
  25581. {
  25582. if (empty($this->filesystem)) {
  25583. $this->filesystem = new Filesystem($this->process);
  25584. }
  25585. return $this->filesystem;
  25586. }
  25587. public function setFilesystem(Filesystem $fs)
  25588. {
  25589. $this->filesystem = $fs;
  25590. }
  25591. }
  25592. <?php
  25593. namespace Composer\Util;
  25594. class Platform
  25595. {
  25596. public static function expandPath($path)
  25597. {
  25598. if (preg_match('#^~[\\/]#', $path)) {
  25599. return self::getUserDirectory() . substr($path, 1);
  25600. }
  25601. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  25602. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  25603. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  25604. }
  25605. return getenv($matches['var']) . $matches['path'];
  25606. }, $path);
  25607. }
  25608. public static function getUserDirectory()
  25609. {
  25610. if (false !== ($home = getenv('HOME'))) {
  25611. return $home;
  25612. }
  25613. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  25614. return $home;
  25615. }
  25616. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  25617. $info = posix_getpwuid(posix_getuid());
  25618. return $info['dir'];
  25619. }
  25620. throw new \RuntimeException('Could not determine user directory');
  25621. }
  25622. public static function isWindows()
  25623. {
  25624. return defined('PHP_WINDOWS_VERSION_BUILD');
  25625. }
  25626. public static function strlen($str)
  25627. {
  25628. static $useMbString = null;
  25629. if (null === $useMbString) {
  25630. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  25631. }
  25632. if ($useMbString) {
  25633. return mb_strlen($str, '8bit');
  25634. }
  25635. return strlen($str);
  25636. }
  25637. }
  25638. <?php
  25639. namespace Composer\Util;
  25640. use Composer\IO\IOInterface;
  25641. use Symfony\Component\Process\Process;
  25642. use Symfony\Component\Process\ProcessUtils;
  25643. class ProcessExecutor
  25644. {
  25645. protected static $timeout = 300;
  25646. protected $captureOutput;
  25647. protected $errorOutput;
  25648. protected $io;
  25649. public function __construct(IOInterface $io = null)
  25650. {
  25651. $this->io = $io;
  25652. }
  25653. public function execute($command, &$output = null, $cwd = null)
  25654. {
  25655. if ($this->io && $this->io->isDebug()) {
  25656. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  25657. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  25658. return '://***:***@';
  25659. }
  25660. return '://'.$m['user'].':***@';
  25661. }, $command);
  25662. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  25663. }
  25664. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  25665. $cwd = realpath(getcwd());
  25666. }
  25667. $this->captureOutput = count(func_get_args()) > 1;
  25668. $this->errorOutput = null;
  25669. $process = new Process($command, $cwd, null, null, static::getTimeout());
  25670. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  25671. $process->run($callback);
  25672. if ($this->captureOutput && !is_callable($output)) {
  25673. $output = $process->getOutput();
  25674. }
  25675. $this->errorOutput = $process->getErrorOutput();
  25676. return $process->getExitCode();
  25677. }
  25678. public function splitLines($output)
  25679. {
  25680. $output = trim($output);
  25681. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  25682. }
  25683. public function getErrorOutput()
  25684. {
  25685. return $this->errorOutput;
  25686. }
  25687. public function outputHandler($type, $buffer)
  25688. {
  25689. if ($this->captureOutput) {
  25690. return;
  25691. }
  25692. if (null === $this->io) {
  25693. echo $buffer;
  25694. return;
  25695. }
  25696. if (Process::ERR === $type) {
  25697. $this->io->writeError($buffer, false);
  25698. } else {
  25699. $this->io->write($buffer, false);
  25700. }
  25701. }
  25702. public static function getTimeout()
  25703. {
  25704. return static::$timeout;
  25705. }
  25706. public static function setTimeout($timeout)
  25707. {
  25708. static::$timeout = $timeout;
  25709. }
  25710. public static function escape($argument)
  25711. {
  25712. if (method_exists('Symfony\Component\Process\ProcessUtils', 'escapeArgument')) {
  25713. return ProcessUtils::escapeArgument($argument);
  25714. }
  25715. return self::escapeArgument($argument);
  25716. }
  25717. private static function escapeArgument($argument)
  25718. {
  25719. if ('\\' === DIRECTORY_SEPARATOR) {
  25720. if ('' === $argument) {
  25721. return escapeshellarg($argument);
  25722. }
  25723. $escapedArgument = '';
  25724. $quote = false;
  25725. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  25726. if ('"' === $part) {
  25727. $escapedArgument .= '\\"';
  25728. } elseif (self::isSurroundedBy($part, '%')) {
  25729. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  25730. } else {
  25731. if ('\\' === substr($part, -1)) {
  25732. $part .= '\\';
  25733. }
  25734. $quote = true;
  25735. $escapedArgument .= $part;
  25736. }
  25737. }
  25738. if ($quote) {
  25739. $escapedArgument = '"'.$escapedArgument.'"';
  25740. }
  25741. return $escapedArgument;
  25742. }
  25743. return "'".str_replace("'", "'\\''", $argument)."'";
  25744. }
  25745. private static function isSurroundedBy($arg, $char)
  25746. {
  25747. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  25748. }
  25749. }
  25750. <?php
  25751. namespace Composer\Util;
  25752. use Composer\Config;
  25753. use Composer\IO\IOInterface;
  25754. use Composer\Downloader\TransportException;
  25755. use Composer\CaBundle\CaBundle;
  25756. use Psr\Log\LoggerInterface;
  25757. class RemoteFilesystem
  25758. {
  25759. private $io;
  25760. private $config;
  25761. private $scheme;
  25762. private $bytesMax;
  25763. private $originUrl;
  25764. private $fileUrl;
  25765. private $fileName;
  25766. private $retry;
  25767. private $progress;
  25768. private $lastProgress;
  25769. private $options = array();
  25770. private $peerCertificateMap = array();
  25771. private $disableTls = false;
  25772. private $retryAuthFailure;
  25773. private $lastHeaders;
  25774. private $storeAuth;
  25775. private $degradedMode = false;
  25776. private $redirects;
  25777. private $maxRedirects = 20;
  25778. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  25779. {
  25780. $this->io = $io;
  25781. if ($disableTls === false) {
  25782. $this->options = $this->getTlsDefaults($options);
  25783. } else {
  25784. $this->disableTls = true;
  25785. }
  25786. $this->options = array_replace_recursive($this->options, $options);
  25787. $this->config = $config;
  25788. }
  25789. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  25790. {
  25791. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  25792. }
  25793. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  25794. {
  25795. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  25796. }
  25797. public function getOptions()
  25798. {
  25799. return $this->options;
  25800. }
  25801. public function setOptions(array $options)
  25802. {
  25803. $this->options = array_replace_recursive($this->options, $options);
  25804. }
  25805. public function isTlsDisabled()
  25806. {
  25807. return $this->disableTls === true;
  25808. }
  25809. public function getLastHeaders()
  25810. {
  25811. return $this->lastHeaders;
  25812. }
  25813. public function findHeaderValue(array $headers, $name)
  25814. {
  25815. $value = null;
  25816. foreach ($headers as $header) {
  25817. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  25818. $value = $match[1];
  25819. } elseif (preg_match('{^HTTP/}i', $header)) {
  25820. $value = null;
  25821. }
  25822. }
  25823. return $value;
  25824. }
  25825. public function findStatusCode(array $headers)
  25826. {
  25827. $value = null;
  25828. foreach ($headers as $header) {
  25829. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  25830. $value = (int) $match[1];
  25831. }
  25832. }
  25833. return $value;
  25834. }
  25835. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  25836. {
  25837. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  25838. $originUrl = 'github.com';
  25839. }
  25840. if (
  25841. $this->config
  25842. && is_array($this->config->get('gitlab-domains'))
  25843. && false === strpos($originUrl, '/')
  25844. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  25845. ) {
  25846. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  25847. if (0 === strpos($gitlabDomain, $originUrl)) {
  25848. $originUrl = $gitlabDomain;
  25849. break;
  25850. }
  25851. }
  25852. unset($gitlabDomain);
  25853. }
  25854. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  25855. $this->bytesMax = 0;
  25856. $this->originUrl = $originUrl;
  25857. $this->fileUrl = $fileUrl;
  25858. $this->fileName = $fileName;
  25859. $this->progress = $progress;
  25860. $this->lastProgress = null;
  25861. $this->retryAuthFailure = true;
  25862. $this->lastHeaders = array();
  25863. $this->redirects = 1;
  25864. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  25865. $this->io->setAuthentication($originUrl, urldecode($match[1]), urldecode($match[2]));
  25866. }
  25867. $tempAdditionalOptions = $additionalOptions;
  25868. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  25869. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  25870. unset($tempAdditionalOptions['retry-auth-failure']);
  25871. }
  25872. $isRedirect = false;
  25873. if (isset($tempAdditionalOptions['redirects'])) {
  25874. $this->redirects = $tempAdditionalOptions['redirects'];
  25875. $isRedirect = true;
  25876. unset($tempAdditionalOptions['redirects']);
  25877. }
  25878. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  25879. unset($tempAdditionalOptions);
  25880. $origFileUrl = $fileUrl;
  25881. if (isset($options['github-token'])) {
  25882. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  25883. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  25884. }
  25885. unset($options['github-token']);
  25886. }
  25887. if (isset($options['gitlab-token'])) {
  25888. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  25889. unset($options['gitlab-token']);
  25890. }
  25891. if (isset($options['http'])) {
  25892. $options['http']['ignore_errors'] = true;
  25893. }
  25894. if ($this->degradedMode && substr($fileUrl, 0, 21) === 'http://packagist.org/') {
  25895. $fileUrl = 'http://' . gethostbyname('packagist.org') . substr($fileUrl, 20);
  25896. $degradedPackagist = true;
  25897. }
  25898. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  25899. $actualContextOptions = stream_context_get_options($ctx);
  25900. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  25901. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $origFileUrl . $usingProxy, true, IOInterface::DEBUG);
  25902. unset($origFileUrl, $actualContextOptions);
  25903. if ((substr($fileUrl, 0, 23) !== 'http://packagist.org/p/' || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  25904. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  25905. }
  25906. if ($this->progress && !$isRedirect) {
  25907. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  25908. }
  25909. $errorMessage = '';
  25910. $errorCode = 0;
  25911. $result = false;
  25912. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  25913. if ($errorMessage) {
  25914. $errorMessage .= "\n";
  25915. }
  25916. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  25917. });
  25918. try {
  25919. list($http_response_header, $result) = $this->getRemoteContents($originUrl, $fileUrl, $ctx);
  25920. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  25921. if ($contentLength && Platform::strlen($result) < $contentLength) {
  25922. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  25923. $e->setHeaders($http_response_header);
  25924. $e->setStatusCode($this->findStatusCode($http_response_header));
  25925. $e->setResponse($result);
  25926. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  25927. throw $e;
  25928. }
  25929. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  25930. $params = stream_context_get_params($ctx);
  25931. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  25932. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  25933. if ($expectedPeerFingerprint !== $peerFingerprint) {
  25934. throw new TransportException('Peer fingerprint did not match');
  25935. }
  25936. }
  25937. } catch (\Exception $e) {
  25938. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  25939. $e->setHeaders($http_response_header);
  25940. $e->setStatusCode($this->findStatusCode($http_response_header));
  25941. }
  25942. if ($e instanceof TransportException && $result !== false) {
  25943. $e->setResponse($result);
  25944. }
  25945. $result = false;
  25946. }
  25947. if ($errorMessage && !ini_get('allow_url_fopen')) {
  25948. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  25949. }
  25950. restore_error_handler();
  25951. if (isset($e) && !$this->retry) {
  25952. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  25953. $this->degradedMode = true;
  25954. $this->io->writeError('');
  25955. $this->io->writeError(array(
  25956. '<error>'.$e->getMessage().'</error>',
  25957. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  25958. ));
  25959. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  25960. }
  25961. throw $e;
  25962. }
  25963. $statusCode = null;
  25964. $contentType = null;
  25965. if (!empty($http_response_header[0])) {
  25966. $statusCode = $this->findStatusCode($http_response_header);
  25967. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  25968. }
  25969. if ($originUrl === 'bitbucket.org'
  25970. && !$this->isPublicBitBucketDownload($fileUrl)
  25971. && substr($fileUrl, -4) === '.zip'
  25972. && $contentType && preg_match('{^text/html\b}i', $contentType)
  25973. ) {
  25974. $result = false;
  25975. if ($this->retryAuthFailure) {
  25976. $this->promptAuthAndRetry(401);
  25977. }
  25978. }
  25979. if ($statusCode === 404
  25980. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  25981. && false !== strpos($fileUrl, 'archive.zip')
  25982. ) {
  25983. $result = false;
  25984. if ($this->retryAuthFailure) {
  25985. $this->promptAuthAndRetry(401);
  25986. }
  25987. }
  25988. $hasFollowedRedirect = false;
  25989. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  25990. $hasFollowedRedirect = true;
  25991. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  25992. }
  25993. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  25994. if (!$this->retry) {
  25995. if ($this->progress && !$this->retry && !$isRedirect) {
  25996. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  25997. }
  25998. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  25999. $e->setHeaders($http_response_header);
  26000. $e->setResponse($result);
  26001. $e->setStatusCode($statusCode);
  26002. throw $e;
  26003. }
  26004. $result = false;
  26005. }
  26006. if ($this->progress && !$this->retry && !$isRedirect) {
  26007. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  26008. }
  26009. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  26010. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  26011. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  26012. if ($decode) {
  26013. try {
  26014. if (PHP_VERSION_ID >= 50400) {
  26015. $result = zlib_decode($result);
  26016. } else {
  26017. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  26018. }
  26019. if (!$result) {
  26020. throw new TransportException('Failed to decode zlib stream');
  26021. }
  26022. } catch (\Exception $e) {
  26023. if ($this->degradedMode) {
  26024. throw $e;
  26025. }
  26026. $this->degradedMode = true;
  26027. $this->io->writeError(array(
  26028. '',
  26029. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  26030. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26031. ));
  26032. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26033. }
  26034. }
  26035. }
  26036. if (false !== $result && null !== $fileName && !$isRedirect) {
  26037. if ('' === $result) {
  26038. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  26039. }
  26040. $errorMessage = '';
  26041. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  26042. if ($errorMessage) {
  26043. $errorMessage .= "\n";
  26044. }
  26045. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  26046. });
  26047. $result = (bool) file_put_contents($fileName, $result);
  26048. restore_error_handler();
  26049. if (false === $result) {
  26050. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  26051. }
  26052. }
  26053. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  26054. if (CaBundle::isOpensslParseSafe()) {
  26055. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  26056. if ($certDetails) {
  26057. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  26058. $this->retry = true;
  26059. }
  26060. } else {
  26061. $this->io->writeError('');
  26062. $this->io->writeError(sprintf(
  26063. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  26064. PHP_VERSION
  26065. ));
  26066. }
  26067. }
  26068. if ($this->retry) {
  26069. $this->retry = false;
  26070. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26071. if ($this->storeAuth && $this->config) {
  26072. $authHelper = new AuthHelper($this->io, $this->config);
  26073. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  26074. $this->storeAuth = false;
  26075. }
  26076. return $result;
  26077. }
  26078. if (false === $result) {
  26079. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  26080. if (!empty($http_response_header[0])) {
  26081. $e->setHeaders($http_response_header);
  26082. }
  26083. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  26084. $this->degradedMode = true;
  26085. $this->io->writeError('');
  26086. $this->io->writeError(array(
  26087. '<error>'.$e->getMessage().'</error>',
  26088. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26089. ));
  26090. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26091. }
  26092. throw $e;
  26093. }
  26094. if (!empty($http_response_header[0])) {
  26095. $this->lastHeaders = $http_response_header;
  26096. }
  26097. return $result;
  26098. }
  26099. protected function getRemoteContents($originUrl, $fileUrl, $context)
  26100. {
  26101. $contents = file_get_contents($fileUrl, false, $context);
  26102. return array($http_response_header, $contents);
  26103. }
  26104. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  26105. {
  26106. switch ($notificationCode) {
  26107. case STREAM_NOTIFY_FAILURE:
  26108. if (400 === $messageCode) {
  26109. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  26110. }
  26111. case STREAM_NOTIFY_AUTH_REQUIRED:
  26112. if (401 === $messageCode) {
  26113. if (!$this->retryAuthFailure) {
  26114. break;
  26115. }
  26116. $this->promptAuthAndRetry($messageCode);
  26117. }
  26118. break;
  26119. case STREAM_NOTIFY_AUTH_RESULT:
  26120. if (403 === $messageCode) {
  26121. if (!$this->retryAuthFailure) {
  26122. break;
  26123. }
  26124. $this->promptAuthAndRetry($messageCode, $message);
  26125. }
  26126. break;
  26127. case STREAM_NOTIFY_FILE_SIZE_IS:
  26128. $this->bytesMax = $bytesMax;
  26129. break;
  26130. case STREAM_NOTIFY_PROGRESS:
  26131. if ($this->bytesMax > 0 && $this->progress) {
  26132. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  26133. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  26134. $this->lastProgress = $progression;
  26135. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  26136. }
  26137. }
  26138. break;
  26139. default:
  26140. break;
  26141. }
  26142. }
  26143. protected function promptAuthAndRetry($httpStatus, $reason = null)
  26144. {
  26145. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  26146. $message = "\n".'Could not fetch '.$this->fileUrl.', please create a GitHub OAuth token '.($httpStatus === 404 ? 'to access private repos' : 'to go over the API rate limit');
  26147. $gitHubUtil = new GitHub($this->io, $this->config, null);
  26148. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  26149. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  26150. ) {
  26151. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  26152. }
  26153. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  26154. $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');
  26155. $gitLabUtil = new GitLab($this->io, $this->config, null);
  26156. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && $auth['password'] === 'private-token') {
  26157. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  26158. }
  26159. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  26160. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  26161. ) {
  26162. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  26163. }
  26164. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  26165. $askForOAuthToken = true;
  26166. if ($this->io->hasAuthentication($this->originUrl)) {
  26167. $auth = $this->io->getAuthentication($this->originUrl);
  26168. if ($auth['username'] !== 'x-token-auth') {
  26169. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  26170. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  26171. if (!empty($accessToken)) {
  26172. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  26173. $askForOAuthToken = false;
  26174. }
  26175. } else {
  26176. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  26177. }
  26178. }
  26179. if ($askForOAuthToken) {
  26180. $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');
  26181. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  26182. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  26183. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  26184. ) {
  26185. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  26186. }
  26187. }
  26188. } else {
  26189. if ($httpStatus === 404) {
  26190. return;
  26191. }
  26192. if (!$this->io->isInteractive()) {
  26193. if ($httpStatus === 401) {
  26194. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  26195. }
  26196. if ($httpStatus === 403) {
  26197. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  26198. }
  26199. throw new TransportException($message, $httpStatus);
  26200. }
  26201. if ($this->io->hasAuthentication($this->originUrl)) {
  26202. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  26203. }
  26204. $this->io->overwriteError('');
  26205. $this->io->writeError(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
  26206. $username = $this->io->ask(' Username: ');
  26207. $password = $this->io->askAndHideAnswer(' Password: ');
  26208. $this->io->setAuthentication($this->originUrl, $username, $password);
  26209. $this->storeAuth = $this->config->get('store-auths');
  26210. }
  26211. $this->retry = true;
  26212. throw new TransportException('RETRY');
  26213. }
  26214. protected function getOptionsForUrl($originUrl, $additionalOptions)
  26215. {
  26216. $tlsOptions = array();
  26217. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  26218. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  26219. if (PHP_VERSION_ID < 50304) {
  26220. if ($host === 'github.com' || $host === 'api.github.com') {
  26221. $host = '*.github.com';
  26222. }
  26223. }
  26224. $tlsOptions['ssl']['CN_match'] = $host;
  26225. $tlsOptions['ssl']['SNI_server_name'] = $host;
  26226. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  26227. if (isset($this->peerCertificateMap[$urlAuthority])) {
  26228. $certMap = $this->peerCertificateMap[$urlAuthority];
  26229. $this->io->writeError('', true, IOInterface::DEBUG);
  26230. $this->io->writeError(sprintf(
  26231. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  26232. $certMap['cn'],
  26233. $urlAuthority
  26234. ), true, IOInterface::DEBUG);
  26235. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  26236. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  26237. }
  26238. }
  26239. $headers = array();
  26240. if (extension_loaded('zlib')) {
  26241. $headers[] = 'Accept-Encoding: gzip';
  26242. }
  26243. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  26244. if (!$this->degradedMode) {
  26245. $options['http']['protocol_version'] = 1.1;
  26246. $headers[] = 'Connection: close';
  26247. }
  26248. if ($this->io->hasAuthentication($originUrl)) {
  26249. $auth = $this->io->getAuthentication($originUrl);
  26250. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  26251. $options['github-token'] = $auth['username'];
  26252. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  26253. if ($auth['password'] === 'oauth2') {
  26254. $headers[] = 'Authorization: Bearer '.$auth['username'];
  26255. } elseif ($auth['password'] === 'private-token') {
  26256. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  26257. }
  26258. } elseif ('bitbucket.org' === $originUrl
  26259. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  26260. ) {
  26261. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  26262. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  26263. }
  26264. } else {
  26265. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  26266. $headers[] = 'Authorization: Basic '.$authStr;
  26267. }
  26268. }
  26269. $options['http']['follow_location'] = 0;
  26270. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  26271. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  26272. }
  26273. foreach ($headers as $header) {
  26274. $options['http']['header'][] = $header;
  26275. }
  26276. return $options;
  26277. }
  26278. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  26279. {
  26280. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  26281. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  26282. $targetUrl = $locationHeader;
  26283. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  26284. $targetUrl = $this->scheme.':'.$locationHeader;
  26285. } elseif ('/' === $locationHeader[0]) {
  26286. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  26287. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  26288. } else {
  26289. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  26290. }
  26291. }
  26292. if (!empty($targetUrl)) {
  26293. $this->redirects++;
  26294. $this->io->writeError('', true, IOInterface::DEBUG);
  26295. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $targetUrl), true, IOInterface::DEBUG);
  26296. $additionalOptions['redirects'] = $this->redirects;
  26297. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  26298. }
  26299. if (!$this->retry) {
  26300. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  26301. $e->setHeaders($http_response_header);
  26302. $e->setResponse($result);
  26303. throw $e;
  26304. }
  26305. return false;
  26306. }
  26307. private function getTlsDefaults(array $options)
  26308. {
  26309. $ciphers = implode(':', array(
  26310. 'ECDHE-RSA-AES128-GCM-SHA256',
  26311. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  26312. 'ECDHE-RSA-AES256-GCM-SHA384',
  26313. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  26314. 'DHE-RSA-AES128-GCM-SHA256',
  26315. 'DHE-DSS-AES128-GCM-SHA256',
  26316. 'kEDH+AESGCM',
  26317. 'ECDHE-RSA-AES128-SHA256',
  26318. 'ECDHE-ECDSA-AES128-SHA256',
  26319. 'ECDHE-RSA-AES128-SHA',
  26320. 'ECDHE-ECDSA-AES128-SHA',
  26321. 'ECDHE-RSA-AES256-SHA384',
  26322. 'ECDHE-ECDSA-AES256-SHA384',
  26323. 'ECDHE-RSA-AES256-SHA',
  26324. 'ECDHE-ECDSA-AES256-SHA',
  26325. 'DHE-RSA-AES128-SHA256',
  26326. 'DHE-RSA-AES128-SHA',
  26327. 'DHE-DSS-AES128-SHA256',
  26328. 'DHE-RSA-AES256-SHA256',
  26329. 'DHE-DSS-AES256-SHA',
  26330. 'DHE-RSA-AES256-SHA',
  26331. 'AES128-GCM-SHA256',
  26332. 'AES256-GCM-SHA384',
  26333. 'AES128-SHA256',
  26334. 'AES256-SHA256',
  26335. 'AES128-SHA',
  26336. 'AES256-SHA',
  26337. 'AES',
  26338. 'CAMELLIA',
  26339. 'DES-CBC3-SHA',
  26340. '!aNULL',
  26341. '!eNULL',
  26342. '!EXPORT',
  26343. '!DES',
  26344. '!RC4',
  26345. '!MD5',
  26346. '!PSK',
  26347. '!aECDH',
  26348. '!EDH-DSS-DES-CBC3-SHA',
  26349. '!EDH-RSA-DES-CBC3-SHA',
  26350. '!KRB5-DES-CBC3-SHA',
  26351. ));
  26352. $defaults = array(
  26353. 'ssl' => array(
  26354. 'ciphers' => $ciphers,
  26355. 'verify_peer' => true,
  26356. 'verify_depth' => 7,
  26357. 'SNI_enabled' => true,
  26358. 'capture_peer_cert' => true,
  26359. ),
  26360. );
  26361. if (isset($options['ssl'])) {
  26362. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  26363. }
  26364. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  26365. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  26366. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  26367. if (is_dir($result)) {
  26368. $defaults['ssl']['capath'] = $result;
  26369. } else {
  26370. $defaults['ssl']['cafile'] = $result;
  26371. }
  26372. }
  26373. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  26374. throw new TransportException('The configured cafile was not valid or could not be read.');
  26375. }
  26376. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  26377. throw new TransportException('The configured capath was not valid or could not be read.');
  26378. }
  26379. if (PHP_VERSION_ID >= 50413) {
  26380. $defaults['ssl']['disable_compression'] = true;
  26381. }
  26382. return $defaults;
  26383. }
  26384. private function getCertificateCnAndFp($url, $options)
  26385. {
  26386. if (PHP_VERSION_ID >= 50600) {
  26387. throw new \BadMethodCallException(sprintf(
  26388. '%s must not be used on PHP >= 5.6',
  26389. __METHOD__
  26390. ));
  26391. }
  26392. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  26393. 'ssl' => array(
  26394. 'capture_peer_cert' => true,
  26395. 'verify_peer' => false,
  26396. ), ),
  26397. ));
  26398. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  26399. return;
  26400. }
  26401. fclose($handle);
  26402. $handle = null;
  26403. $params = stream_context_get_params($context);
  26404. if (!empty($params['options']['ssl']['peer_certificate'])) {
  26405. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  26406. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  26407. return array(
  26408. 'cn' => $commonName,
  26409. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  26410. );
  26411. }
  26412. }
  26413. }
  26414. private function getUrlAuthority($url)
  26415. {
  26416. $defaultPorts = array(
  26417. 'ftp' => 21,
  26418. 'http' => 80,
  26419. 'https' => 443,
  26420. 'ssh2.sftp' => 22,
  26421. 'ssh2.scp' => 22,
  26422. );
  26423. $scheme = parse_url($url, PHP_URL_SCHEME);
  26424. if (!isset($defaultPorts[$scheme])) {
  26425. throw new \InvalidArgumentException(sprintf(
  26426. 'Could not get default port for unknown scheme: %s',
  26427. $scheme
  26428. ));
  26429. }
  26430. $defaultPort = $defaultPorts[$scheme];
  26431. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  26432. return parse_url($url, PHP_URL_HOST).':'.$port;
  26433. }
  26434. private function isPublicBitBucketDownload($urlToBitBucketFile)
  26435. {
  26436. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  26437. if (strpos($domain, 'bitbucket.org') === false) {
  26438. return true;
  26439. }
  26440. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  26441. $pathParts = explode('/', $path);
  26442. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  26443. }
  26444. }
  26445. <?php
  26446. namespace Composer\Util;
  26447. class Silencer
  26448. {
  26449. private static $stack = array();
  26450. public static function suppress($mask = null)
  26451. {
  26452. if (!isset($mask)) {
  26453. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  26454. }
  26455. $old = error_reporting();
  26456. self::$stack[] = $old;
  26457. error_reporting($old & ~$mask);
  26458. return $old;
  26459. }
  26460. public static function restore()
  26461. {
  26462. if (!empty(self::$stack)) {
  26463. error_reporting(array_pop(self::$stack));
  26464. }
  26465. }
  26466. public static function call($callable )
  26467. {
  26468. try {
  26469. self::suppress();
  26470. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  26471. self::restore();
  26472. return $result;
  26473. } catch (\Exception $e) {
  26474. self::restore();
  26475. throw $e;
  26476. }
  26477. }
  26478. }
  26479. <?php
  26480. namespace Composer\Util;
  26481. use Composer\Spdx\SpdxLicenses;
  26482. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  26483. class SpdxLicense extends SpdxLicenses
  26484. {
  26485. }
  26486. <?php
  26487. namespace Composer\Util;
  26488. use Composer\Composer;
  26489. final class StreamContextFactory
  26490. {
  26491. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  26492. {
  26493. $options = array('http' => array(
  26494. 'follow_location' => 1,
  26495. 'max_redirects' => 20,
  26496. ));
  26497. if (PHP_SAPI === 'cli' && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  26498. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  26499. }
  26500. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  26501. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  26502. }
  26503. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  26504. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  26505. }
  26506. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  26507. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  26508. if ($pattern->test($url)) {
  26509. unset($proxy);
  26510. }
  26511. }
  26512. if (!empty($proxy)) {
  26513. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  26514. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  26515. if (isset($proxy['port'])) {
  26516. $proxyURL .= ":" . $proxy['port'];
  26517. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  26518. $proxyURL .= ":80";
  26519. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  26520. $proxyURL .= ":443";
  26521. }
  26522. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  26523. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  26524. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  26525. }
  26526. $options['http']['proxy'] = $proxyURL;
  26527. switch (parse_url($url, PHP_URL_SCHEME)) {
  26528. case 'http':
  26529. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  26530. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  26531. $options['http']['request_fulluri'] = true;
  26532. }
  26533. break;
  26534. case 'https':
  26535. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  26536. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  26537. $options['http']['request_fulluri'] = true;
  26538. }
  26539. break;
  26540. }
  26541. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  26542. $options['ssl']['SNI_enabled'] = true;
  26543. if (PHP_VERSION_ID < 50600) {
  26544. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  26545. }
  26546. }
  26547. if (isset($proxy['user'])) {
  26548. $auth = urldecode($proxy['user']);
  26549. if (isset($proxy['pass'])) {
  26550. $auth .= ':' . urldecode($proxy['pass']);
  26551. }
  26552. $auth = base64_encode($auth);
  26553. if (isset($defaultOptions['http']['header'])) {
  26554. if (is_string($defaultOptions['http']['header'])) {
  26555. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  26556. }
  26557. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  26558. } else {
  26559. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  26560. }
  26561. }
  26562. }
  26563. $options = array_replace_recursive($options, $defaultOptions);
  26564. if (isset($options['http']['header'])) {
  26565. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  26566. }
  26567. if (defined('HHVM_VERSION')) {
  26568. $phpVersion = 'HHVM ' . HHVM_VERSION;
  26569. } else {
  26570. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  26571. }
  26572. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  26573. $options['http']['header'][] = sprintf(
  26574. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  26575. Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
  26576. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  26577. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  26578. $phpVersion,
  26579. getenv('CI') ? '; CI' : ''
  26580. );
  26581. }
  26582. return stream_context_create($options, $defaultParams);
  26583. }
  26584. private static function fixHttpHeaderField($header)
  26585. {
  26586. if (!is_array($header)) {
  26587. $header = explode("\r\n", $header);
  26588. }
  26589. uasort($header, function ($el) {
  26590. return stripos($el, 'content-type') === 0 ? 1 : -1;
  26591. });
  26592. return $header;
  26593. }
  26594. }
  26595. <?php
  26596. namespace Composer\Util;
  26597. use Composer\Config;
  26598. use Composer\IO\IOInterface;
  26599. class Svn
  26600. {
  26601. const MAX_QTY_AUTH_TRIES = 5;
  26602. protected $credentials;
  26603. protected $hasAuth;
  26604. protected $io;
  26605. protected $url;
  26606. protected $cacheCredentials = true;
  26607. protected $process;
  26608. protected $qtyAuthTries = 0;
  26609. protected $config;
  26610. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  26611. {
  26612. $this->url = $url;
  26613. $this->io = $io;
  26614. $this->config = $config;
  26615. $this->process = $process ?: new ProcessExecutor;
  26616. }
  26617. public static function cleanEnv()
  26618. {
  26619. putenv("DYLD_LIBRARY_PATH");
  26620. unset($_SERVER['DYLD_LIBRARY_PATH']);
  26621. }
  26622. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  26623. {
  26624. $this->config->prohibitUrlByConfig($url, $this->io);
  26625. $svnCommand = $this->getCommand($command, $url, $path);
  26626. return $this->executeWithAuthRetry($svnCommand, $cwd, $path, $verbose);
  26627. }
  26628. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  26629. {
  26630. $svnCommand = sprintf('%s %s%s %s',
  26631. $command,
  26632. '--non-interactive ',
  26633. $this->getCredentialString(),
  26634. ProcessExecutor::escape($path)
  26635. );
  26636. return $this->executeWithAuthRetry($svnCommand, $cwd, $path, $verbose);
  26637. }
  26638. private function executeWithAuthRetry($command, $cwd, $path, $verbose)
  26639. {
  26640. $output = null;
  26641. $io = $this->io;
  26642. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  26643. if ($type !== 'out') {
  26644. return;
  26645. }
  26646. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  26647. return;
  26648. }
  26649. $output .= $buffer;
  26650. if ($verbose) {
  26651. $io->writeError($buffer, false);
  26652. }
  26653. };
  26654. $status = $this->process->execute($command, $handler, $cwd);
  26655. if (0 === $status) {
  26656. return $output;
  26657. }
  26658. $errorOutput = $this->process->getErrorOutput();
  26659. $fullOutput = implode("\n", array($output, $errorOutput));
  26660. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  26661. && false === stripos($fullOutput, 'authorization failed')
  26662. && false === stripos($fullOutput, 'svn: E170001:')
  26663. && false === stripos($fullOutput, 'svn: E215004:')) {
  26664. throw new \RuntimeException($fullOutput);
  26665. }
  26666. if (!$this->hasAuth()) {
  26667. $this->doAuthDance();
  26668. }
  26669. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  26670. return $this->executeWithAuthRetry($command, $cwd, $path, $verbose);
  26671. }
  26672. throw new \RuntimeException(
  26673. 'wrong credentials provided ('.$fullOutput.')'
  26674. );
  26675. }
  26676. public function setCacheCredentials($cacheCredentials)
  26677. {
  26678. $this->cacheCredentials = $cacheCredentials;
  26679. }
  26680. protected function doAuthDance()
  26681. {
  26682. if (!$this->io->isInteractive()) {
  26683. throw new \RuntimeException(
  26684. 'can not ask for authentication in non interactive mode'
  26685. );
  26686. }
  26687. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  26688. $this->hasAuth = true;
  26689. $this->credentials['username'] = $this->io->ask("Username: ");
  26690. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  26691. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  26692. return $this;
  26693. }
  26694. protected function getCommand($cmd, $url, $path = null)
  26695. {
  26696. $cmd = sprintf('%s %s%s %s',
  26697. $cmd,
  26698. '--non-interactive ',
  26699. $this->getCredentialString(),
  26700. ProcessExecutor::escape($url)
  26701. );
  26702. if ($path) {
  26703. $cmd .= ' ' . ProcessExecutor::escape($path);
  26704. }
  26705. return $cmd;
  26706. }
  26707. protected function getCredentialString()
  26708. {
  26709. if (!$this->hasAuth()) {
  26710. return '';
  26711. }
  26712. return sprintf(
  26713. ' %s--username %s --password %s ',
  26714. $this->getAuthCache(),
  26715. ProcessExecutor::escape($this->getUsername()),
  26716. ProcessExecutor::escape($this->getPassword())
  26717. );
  26718. }
  26719. protected function getPassword()
  26720. {
  26721. if ($this->credentials === null) {
  26722. throw new \LogicException("No svn auth detected.");
  26723. }
  26724. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  26725. }
  26726. protected function getUsername()
  26727. {
  26728. if ($this->credentials === null) {
  26729. throw new \LogicException("No svn auth detected.");
  26730. }
  26731. return $this->credentials['username'];
  26732. }
  26733. protected function hasAuth()
  26734. {
  26735. if (null !== $this->hasAuth) {
  26736. return $this->hasAuth;
  26737. }
  26738. if (false === $this->createAuthFromConfig()) {
  26739. $this->createAuthFromUrl();
  26740. }
  26741. return $this->hasAuth;
  26742. }
  26743. protected function getAuthCache()
  26744. {
  26745. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  26746. }
  26747. private function createAuthFromConfig()
  26748. {
  26749. if (!$this->config->has('http-basic')) {
  26750. return $this->hasAuth = false;
  26751. }
  26752. $authConfig = $this->config->get('http-basic');
  26753. $host = parse_url($this->url, PHP_URL_HOST);
  26754. if (isset($authConfig[$host])) {
  26755. $this->credentials['username'] = $authConfig[$host]['username'];
  26756. $this->credentials['password'] = $authConfig[$host]['password'];
  26757. return $this->hasAuth = true;
  26758. }
  26759. return $this->hasAuth = false;
  26760. }
  26761. private function createAuthFromUrl()
  26762. {
  26763. $uri = parse_url($this->url);
  26764. if (empty($uri['user'])) {
  26765. return $this->hasAuth = false;
  26766. }
  26767. $this->credentials['username'] = $uri['user'];
  26768. if (!empty($uri['pass'])) {
  26769. $this->credentials['password'] = $uri['pass'];
  26770. }
  26771. return $this->hasAuth = true;
  26772. }
  26773. }
  26774. <?php
  26775. namespace Composer\Util;
  26776. use Composer\CaBundle\CaBundle;
  26777. final class TlsHelper
  26778. {
  26779. private static $useOpensslParse;
  26780. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  26781. {
  26782. $names = self::getCertificateNames($certificate);
  26783. if (empty($names)) {
  26784. return false;
  26785. }
  26786. $combinedNames = array_merge($names['san'], array($names['cn']));
  26787. $hostname = strtolower($hostname);
  26788. foreach ($combinedNames as $certName) {
  26789. $matcher = self::certNameMatcher($certName);
  26790. if ($matcher && $matcher($hostname)) {
  26791. $cn = $names['cn'];
  26792. return true;
  26793. }
  26794. }
  26795. return false;
  26796. }
  26797. public static function getCertificateNames($certificate)
  26798. {
  26799. if (is_array($certificate)) {
  26800. $info = $certificate;
  26801. } elseif (CaBundle::isOpensslParseSafe()) {
  26802. $info = openssl_x509_parse($certificate, false);
  26803. }
  26804. if (!isset($info['subject']['commonName'])) {
  26805. return null;
  26806. }
  26807. $commonName = strtolower($info['subject']['commonName']);
  26808. $subjectAltNames = array();
  26809. if (isset($info['extensions']['subjectAltName'])) {
  26810. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  26811. $subjectAltNames = array_filter(array_map(function ($name) {
  26812. if (0 === strpos($name, 'DNS:')) {
  26813. return strtolower(ltrim(substr($name, 4)));
  26814. }
  26815. return null;
  26816. }, $subjectAltNames));
  26817. $subjectAltNames = array_values($subjectAltNames);
  26818. }
  26819. return array(
  26820. 'cn' => $commonName,
  26821. 'san' => $subjectAltNames,
  26822. );
  26823. }
  26824. public static function getCertificateFingerprint($certificate)
  26825. {
  26826. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  26827. $pubkeypem = $pubkeydetails['key'];
  26828. $start = '-----BEGIN PUBLIC KEY-----';
  26829. $end = '-----END PUBLIC KEY-----';
  26830. $pemtrim = substr($pubkeypem, (strpos($pubkeypem, $start) + strlen($start)), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  26831. $der = base64_decode($pemtrim);
  26832. return sha1($der);
  26833. }
  26834. public static function isOpensslParseSafe()
  26835. {
  26836. return CaBundle::isOpensslParseSafe();
  26837. }
  26838. private static function certNameMatcher($certName)
  26839. {
  26840. $wildcards = substr_count($certName, '*');
  26841. if (0 === $wildcards) {
  26842. return function ($hostname) use ($certName) {
  26843. return $hostname === $certName;
  26844. };
  26845. }
  26846. if (1 === $wildcards) {
  26847. $components = explode('.', $certName);
  26848. if (3 > count($components)) {
  26849. return;
  26850. }
  26851. $firstComponent = $components[0];
  26852. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  26853. return;
  26854. }
  26855. $wildcardRegex = preg_quote($certName);
  26856. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  26857. $wildcardRegex = "{^{$wildcardRegex}$}";
  26858. return function ($hostname) use ($wildcardRegex) {
  26859. return 1 === preg_match($wildcardRegex, $hostname);
  26860. };
  26861. }
  26862. }
  26863. }
  26864. <?php
  26865. namespace Composer\Util;
  26866. use Composer\Config;
  26867. use Composer\IO\IOInterface;
  26868. class Url
  26869. {
  26870. public static function updateDistReference(Config $config, $url, $ref)
  26871. {
  26872. $host = parse_url($url, PHP_URL_HOST);
  26873. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  26874. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  26875. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  26876. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  26877. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  26878. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  26879. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  26880. }
  26881. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  26882. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  26883. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  26884. }
  26885. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  26886. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  26887. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  26888. }
  26889. } elseif (in_array($host, $config->get('github-domains'), true)) {
  26890. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  26891. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  26892. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  26893. }
  26894. return $url;
  26895. }
  26896. }
  26897. <?php
  26898. namespace Composer;
  26899. use Composer\Util\IniHelper;
  26900. use Symfony\Component\Console\Output\OutputInterface;
  26901. class XdebugHandler
  26902. {
  26903. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  26904. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  26905. const RESTART_ID = 'internal';
  26906. private $output;
  26907. private $loaded;
  26908. private $envScanDir;
  26909. private $version;
  26910. private $tmpIni;
  26911. public function __construct(OutputInterface $output)
  26912. {
  26913. $this->output = $output;
  26914. $this->loaded = extension_loaded('xdebug');
  26915. $this->envScanDir = getenv('PHP_INI_SCAN_DIR');
  26916. if ($this->loaded) {
  26917. $ext = new \ReflectionExtension('xdebug');
  26918. $this->version = strval($ext->getVersion());
  26919. }
  26920. }
  26921. public function check()
  26922. {
  26923. $args = explode('|', strval(getenv(self::ENV_ALLOW)), 2);
  26924. if ($this->needsRestart($args[0])) {
  26925. if ($this->prepareRestart()) {
  26926. $command = $this->getCommand();
  26927. $this->restart($command);
  26928. }
  26929. return;
  26930. }
  26931. if (self::RESTART_ID === $args[0]) {
  26932. putenv(self::ENV_ALLOW);
  26933. if (false !== $this->envScanDir) {
  26934. if (isset($args[1])) {
  26935. putenv('PHP_INI_SCAN_DIR='.$args[1]);
  26936. } else {
  26937. putenv('PHP_INI_SCAN_DIR');
  26938. }
  26939. }
  26940. if ($this->loaded) {
  26941. putenv(self::ENV_VERSION);
  26942. }
  26943. }
  26944. }
  26945. protected function restart($command)
  26946. {
  26947. passthru($command, $exitCode);
  26948. if (!empty($this->tmpIni)) {
  26949. @unlink($this->tmpIni);
  26950. }
  26951. exit($exitCode);
  26952. }
  26953. private function needsRestart($allow)
  26954. {
  26955. if (PHP_SAPI !== 'cli' || !defined('PHP_BINARY')) {
  26956. return false;
  26957. }
  26958. return empty($allow) && $this->loaded;
  26959. }
  26960. private function prepareRestart()
  26961. {
  26962. $this->tmpIni = '';
  26963. $iniPaths = IniHelper::getAll();
  26964. $additional = count($iniPaths) > 1;
  26965. if ($this->writeTmpIni($iniPaths)) {
  26966. return $this->setEnvironment($additional, $iniPaths);
  26967. }
  26968. return false;
  26969. }
  26970. private function writeTmpIni(array $iniPaths)
  26971. {
  26972. if (!$this->tmpIni = tempnam(sys_get_temp_dir(), '')) {
  26973. return false;
  26974. }
  26975. if (empty($iniPaths[0])) {
  26976. array_shift($iniPaths);
  26977. }
  26978. $content = '';
  26979. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  26980. foreach ($iniPaths as $file) {
  26981. $data = preg_replace($regex, ';$1', file_get_contents($file));
  26982. $content .= $data.PHP_EOL;
  26983. }
  26984. $content .= 'allow_url_fopen='.ini_get('allow_url_fopen').PHP_EOL;
  26985. $content .= 'disable_functions="'.ini_get('disable_functions').'"'.PHP_EOL;
  26986. $content .= 'memory_limit='.ini_get('memory_limit').PHP_EOL;
  26987. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  26988. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  26989. }
  26990. return @file_put_contents($this->tmpIni, $content);
  26991. }
  26992. private function getCommand()
  26993. {
  26994. $phpArgs = array(PHP_BINARY, '-c', $this->tmpIni);
  26995. $params = array_merge($phpArgs, $this->getScriptArgs($_SERVER['argv']));
  26996. return implode(' ', array_map(array($this, 'escape'), $params));
  26997. }
  26998. private function setEnvironment($additional, array $iniPaths)
  26999. {
  27000. if ($additional && !putenv('PHP_INI_SCAN_DIR=')) {
  27001. return false;
  27002. }
  27003. if (!putenv(IniHelper::ENV_ORIGINAL.'='.implode(PATH_SEPARATOR, $iniPaths))) {
  27004. return false;
  27005. }
  27006. if (!putenv(self::ENV_VERSION.'='.$this->version)) {
  27007. return false;
  27008. }
  27009. $args = array(self::RESTART_ID);
  27010. if (false !== $this->envScanDir) {
  27011. $args[] = $this->envScanDir;
  27012. }
  27013. return putenv(self::ENV_ALLOW.'='.implode('|', $args));
  27014. }
  27015. private function getScriptArgs(array $args)
  27016. {
  27017. if (in_array('--no-ansi', $args) || in_array('--ansi', $args)) {
  27018. return $args;
  27019. }
  27020. if ($this->output->isDecorated()) {
  27021. $offset = count($args) > 1 ? 2 : 1;
  27022. array_splice($args, $offset, 0, '--ansi');
  27023. }
  27024. return $args;
  27025. }
  27026. private function escape($arg, $meta = true)
  27027. {
  27028. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  27029. return escapeshellarg($arg);
  27030. }
  27031. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  27032. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  27033. if ($meta) {
  27034. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  27035. if (!$meta && !$quote) {
  27036. $quote = strpbrk($arg, '^&|<>()') !== false;
  27037. }
  27038. }
  27039. if ($quote) {
  27040. $arg = preg_replace('/(\\\\*)$/', '$1$1', $arg);
  27041. $arg = '"'.$arg.'"';
  27042. }
  27043. if ($meta) {
  27044. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  27045. }
  27046. return $arg;
  27047. }
  27048. }
  27049. <?php
  27050. function includeIfExists($file)
  27051. {
  27052. return file_exists($file) ? include $file : false;
  27053. }
  27054. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  27055. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  27056. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  27057. exit(1);
  27058. }
  27059. return $loader;
  27060. <?php
  27061. /*
  27062. * This file is part of Composer.
  27063. *
  27064. * (c) Nils Adermann <naderman@naderman.de>
  27065. * Jordi Boggiano <j.boggiano@seld.be>
  27066. *
  27067. * For the full copyright and license information, please view the LICENSE
  27068. * file that was distributed with this source code.
  27069. */
  27070. namespace Composer\Autoload;
  27071. /**
  27072. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  27073. *
  27074. * $loader = new \Composer\Autoload\ClassLoader();
  27075. *
  27076. * // register classes with namespaces
  27077. * $loader->add('Symfony\Component', __DIR__.'/component');
  27078. * $loader->add('Symfony', __DIR__.'/framework');
  27079. *
  27080. * // activate the autoloader
  27081. * $loader->register();
  27082. *
  27083. * // to enable searching the include path (eg. for PEAR packages)
  27084. * $loader->setUseIncludePath(true);
  27085. *
  27086. * In this example, if you try to use a class in the Symfony\Component
  27087. * namespace or one of its children (Symfony\Component\Console for instance),
  27088. * the autoloader will first look for the class under the component/
  27089. * directory, and it will then fallback to the framework/ directory if not
  27090. * found before giving up.
  27091. *
  27092. * This class is loosely based on the Symfony UniversalClassLoader.
  27093. *
  27094. * @author Fabien Potencier <fabien@symfony.com>
  27095. * @author Jordi Boggiano <j.boggiano@seld.be>
  27096. * @see http://www.php-fig.org/psr/psr-0/
  27097. * @see http://www.php-fig.org/psr/psr-4/
  27098. */
  27099. class ClassLoader
  27100. {
  27101. // PSR-4
  27102. private $prefixLengthsPsr4 = array();
  27103. private $prefixDirsPsr4 = array();
  27104. private $fallbackDirsPsr4 = array();
  27105. // PSR-0
  27106. private $prefixesPsr0 = array();
  27107. private $fallbackDirsPsr0 = array();
  27108. private $useIncludePath = false;
  27109. private $classMap = array();
  27110. private $classMapAuthoritative = false;
  27111. private $missingClasses = array();
  27112. private $apcuPrefix;
  27113. public function getPrefixes()
  27114. {
  27115. if (!empty($this->prefixesPsr0)) {
  27116. return call_user_func_array('array_merge', $this->prefixesPsr0);
  27117. }
  27118. return array();
  27119. }
  27120. public function getPrefixesPsr4()
  27121. {
  27122. return $this->prefixDirsPsr4;
  27123. }
  27124. public function getFallbackDirs()
  27125. {
  27126. return $this->fallbackDirsPsr0;
  27127. }
  27128. public function getFallbackDirsPsr4()
  27129. {
  27130. return $this->fallbackDirsPsr4;
  27131. }
  27132. public function getClassMap()
  27133. {
  27134. return $this->classMap;
  27135. }
  27136. /**
  27137. * @param array $classMap Class to filename map
  27138. */
  27139. public function addClassMap(array $classMap)
  27140. {
  27141. if ($this->classMap) {
  27142. $this->classMap = array_merge($this->classMap, $classMap);
  27143. } else {
  27144. $this->classMap = $classMap;
  27145. }
  27146. }
  27147. /**
  27148. * Registers a set of PSR-0 directories for a given prefix, either
  27149. * appending or prepending to the ones previously set for this prefix.
  27150. *
  27151. * @param string $prefix The prefix
  27152. * @param array|string $paths The PSR-0 root directories
  27153. * @param bool $prepend Whether to prepend the directories
  27154. */
  27155. public function add($prefix, $paths, $prepend = false)
  27156. {
  27157. if (!$prefix) {
  27158. if ($prepend) {
  27159. $this->fallbackDirsPsr0 = array_merge(
  27160. (array) $paths,
  27161. $this->fallbackDirsPsr0
  27162. );
  27163. } else {
  27164. $this->fallbackDirsPsr0 = array_merge(
  27165. $this->fallbackDirsPsr0,
  27166. (array) $paths
  27167. );
  27168. }
  27169. return;
  27170. }
  27171. $first = $prefix[0];
  27172. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  27173. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  27174. return;
  27175. }
  27176. if ($prepend) {
  27177. $this->prefixesPsr0[$first][$prefix] = array_merge(
  27178. (array) $paths,
  27179. $this->prefixesPsr0[$first][$prefix]
  27180. );
  27181. } else {
  27182. $this->prefixesPsr0[$first][$prefix] = array_merge(
  27183. $this->prefixesPsr0[$first][$prefix],
  27184. (array) $paths
  27185. );
  27186. }
  27187. }
  27188. /**
  27189. * Registers a set of PSR-4 directories for a given namespace, either
  27190. * appending or prepending to the ones previously set for this namespace.
  27191. *
  27192. * @param string $prefix The prefix/namespace, with trailing '\\'
  27193. * @param array|string $paths The PSR-4 base directories
  27194. * @param bool $prepend Whether to prepend the directories
  27195. *
  27196. * @throws \InvalidArgumentException
  27197. */
  27198. public function addPsr4($prefix, $paths, $prepend = false)
  27199. {
  27200. if (!$prefix) {
  27201. // Register directories for the root namespace.
  27202. if ($prepend) {
  27203. $this->fallbackDirsPsr4 = array_merge(
  27204. (array) $paths,
  27205. $this->fallbackDirsPsr4
  27206. );
  27207. } else {
  27208. $this->fallbackDirsPsr4 = array_merge(
  27209. $this->fallbackDirsPsr4,
  27210. (array) $paths
  27211. );
  27212. }
  27213. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  27214. // Register directories for a new namespace.
  27215. $length = strlen($prefix);
  27216. if ('\\' !== $prefix[$length - 1]) {
  27217. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  27218. }
  27219. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  27220. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  27221. } elseif ($prepend) {
  27222. // Prepend directories for an already registered namespace.
  27223. $this->prefixDirsPsr4[$prefix] = array_merge(
  27224. (array) $paths,
  27225. $this->prefixDirsPsr4[$prefix]
  27226. );
  27227. } else {
  27228. // Append directories for an already registered namespace.
  27229. $this->prefixDirsPsr4[$prefix] = array_merge(
  27230. $this->prefixDirsPsr4[$prefix],
  27231. (array) $paths
  27232. );
  27233. }
  27234. }
  27235. /**
  27236. * Registers a set of PSR-0 directories for a given prefix,
  27237. * replacing any others previously set for this prefix.
  27238. *
  27239. * @param string $prefix The prefix
  27240. * @param array|string $paths The PSR-0 base directories
  27241. */
  27242. public function set($prefix, $paths)
  27243. {
  27244. if (!$prefix) {
  27245. $this->fallbackDirsPsr0 = (array) $paths;
  27246. } else {
  27247. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  27248. }
  27249. }
  27250. /**
  27251. * Registers a set of PSR-4 directories for a given namespace,
  27252. * replacing any others previously set for this namespace.
  27253. *
  27254. * @param string $prefix The prefix/namespace, with trailing '\\'
  27255. * @param array|string $paths The PSR-4 base directories
  27256. *
  27257. * @throws \InvalidArgumentException
  27258. */
  27259. public function setPsr4($prefix, $paths)
  27260. {
  27261. if (!$prefix) {
  27262. $this->fallbackDirsPsr4 = (array) $paths;
  27263. } else {
  27264. $length = strlen($prefix);
  27265. if ('\\' !== $prefix[$length - 1]) {
  27266. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  27267. }
  27268. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  27269. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  27270. }
  27271. }
  27272. /**
  27273. * Turns on searching the include path for class files.
  27274. *
  27275. * @param bool $useIncludePath
  27276. */
  27277. public function setUseIncludePath($useIncludePath)
  27278. {
  27279. $this->useIncludePath = $useIncludePath;
  27280. }
  27281. /**
  27282. * Can be used to check if the autoloader uses the include path to check
  27283. * for classes.
  27284. *
  27285. * @return bool
  27286. */
  27287. public function getUseIncludePath()
  27288. {
  27289. return $this->useIncludePath;
  27290. }
  27291. /**
  27292. * Turns off searching the prefix and fallback directories for classes
  27293. * that have not been registered with the class map.
  27294. *
  27295. * @param bool $classMapAuthoritative
  27296. */
  27297. public function setClassMapAuthoritative($classMapAuthoritative)
  27298. {
  27299. $this->classMapAuthoritative = $classMapAuthoritative;
  27300. }
  27301. /**
  27302. * Should class lookup fail if not found in the current class map?
  27303. *
  27304. * @return bool
  27305. */
  27306. public function isClassMapAuthoritative()
  27307. {
  27308. return $this->classMapAuthoritative;
  27309. }
  27310. /**
  27311. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  27312. *
  27313. * @param string|null $apcuPrefix
  27314. */
  27315. public function setApcuPrefix($apcuPrefix)
  27316. {
  27317. $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
  27318. }
  27319. /**
  27320. * The APCu prefix in use, or null if APCu caching is not enabled.
  27321. *
  27322. * @return string|null
  27323. */
  27324. public function getApcuPrefix()
  27325. {
  27326. return $this->apcuPrefix;
  27327. }
  27328. /**
  27329. * Registers this instance as an autoloader.
  27330. *
  27331. * @param bool $prepend Whether to prepend the autoloader or not
  27332. */
  27333. public function register($prepend = false)
  27334. {
  27335. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  27336. }
  27337. /**
  27338. * Unregisters this instance as an autoloader.
  27339. */
  27340. public function unregister()
  27341. {
  27342. spl_autoload_unregister(array($this, 'loadClass'));
  27343. }
  27344. /**
  27345. * Loads the given class or interface.
  27346. *
  27347. * @param string $class The name of the class
  27348. * @return bool|null True if loaded, null otherwise
  27349. */
  27350. public function loadClass($class)
  27351. {
  27352. if ($file = $this->findFile($class)) {
  27353. includeFile($file);
  27354. return true;
  27355. }
  27356. }
  27357. /**
  27358. * Finds the path to the file where the class is defined.
  27359. *
  27360. * @param string $class The name of the class
  27361. *
  27362. * @return string|false The path if found, false otherwise
  27363. */
  27364. public function findFile($class)
  27365. {
  27366. // class map lookup
  27367. if (isset($this->classMap[$class])) {
  27368. return $this->classMap[$class];
  27369. }
  27370. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  27371. return false;
  27372. }
  27373. if (null !== $this->apcuPrefix) {
  27374. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  27375. if ($hit) {
  27376. return $file;
  27377. }
  27378. }
  27379. $file = $this->findFileWithExtension($class, '.php');
  27380. // Search for Hack files if we are running on HHVM
  27381. if (false === $file && defined('HHVM_VERSION')) {
  27382. $file = $this->findFileWithExtension($class, '.hh');
  27383. }
  27384. if (null !== $this->apcuPrefix) {
  27385. apcu_add($this->apcuPrefix.$class, $file);
  27386. }
  27387. if (false === $file) {
  27388. // Remember that this class does not exist.
  27389. $this->missingClasses[$class] = true;
  27390. }
  27391. return $file;
  27392. }
  27393. private function findFileWithExtension($class, $ext)
  27394. {
  27395. // PSR-4 lookup
  27396. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  27397. $first = $class[0];
  27398. if (isset($this->prefixLengthsPsr4[$first])) {
  27399. $subPath = $class;
  27400. while (false !== $lastPos = strrpos($subPath, '\\')) {
  27401. $subPath = substr($subPath, 0, $lastPos);
  27402. $search = $subPath.'\\';
  27403. if (isset($this->prefixDirsPsr4[$search])) {
  27404. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  27405. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  27406. if (file_exists($file = $dir . $pathEnd)) {
  27407. return $file;
  27408. }
  27409. }
  27410. }
  27411. }
  27412. }
  27413. // PSR-4 fallback dirs
  27414. foreach ($this->fallbackDirsPsr4 as $dir) {
  27415. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  27416. return $file;
  27417. }
  27418. }
  27419. // PSR-0 lookup
  27420. if (false !== $pos = strrpos($class, '\\')) {
  27421. // namespaced class name
  27422. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  27423. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  27424. } else {
  27425. // PEAR-like class name
  27426. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  27427. }
  27428. if (isset($this->prefixesPsr0[$first])) {
  27429. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  27430. if (0 === strpos($class, $prefix)) {
  27431. foreach ($dirs as $dir) {
  27432. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  27433. return $file;
  27434. }
  27435. }
  27436. }
  27437. }
  27438. }
  27439. // PSR-0 fallback dirs
  27440. foreach ($this->fallbackDirsPsr0 as $dir) {
  27441. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  27442. return $file;
  27443. }
  27444. }
  27445. // PSR-0 include paths.
  27446. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  27447. return $file;
  27448. }
  27449. return false;
  27450. }
  27451. }
  27452. /**
  27453. * Scope isolated include.
  27454. *
  27455. * Prevents access to $this/self from included files.
  27456. */
  27457. function includeFile($file)
  27458. {
  27459. include $file;
  27460. }
  27461. {
  27462. "$schema": "http://json-schema.org/draft-04/schema#",
  27463. "description": "A representation of packages metadata.",
  27464. "type": "object",
  27465. "oneOf": [
  27466. { "required": [ "packages" ] },
  27467. { "required": [ "providers" ] },
  27468. { "required": [ "provider-includes", "providers-url" ] }
  27469. ],
  27470. "properties": {
  27471. "packages": {
  27472. "type": ["object", "array"],
  27473. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  27474. "additionalProperties": { "$ref": "#/definitions/versions" }
  27475. },
  27476. "providers-url": {
  27477. "type": "string",
  27478. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  27479. },
  27480. "provider-includes": {
  27481. "type": "object",
  27482. "description": "A hashmap of provider listings.",
  27483. "additionalProperties": { "$ref": "#/definitions/provider" }
  27484. },
  27485. "providers": {
  27486. "type": "object",
  27487. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  27488. "additionalProperties": { "$ref": "#/definitions/provider" }
  27489. },
  27490. "notify-batch": {
  27491. "type": "string",
  27492. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  27493. },
  27494. "search": {
  27495. "type": "string",
  27496. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  27497. },
  27498. "warning": {
  27499. "type": "string",
  27500. "description": "A message that will be output by Composer as a warning when this source is consulted."
  27501. }
  27502. },
  27503. "definitions": {
  27504. "versions": {
  27505. "type": "object",
  27506. "description": "A hashmap of versions and their metadata.",
  27507. "additionalProperties": { "$ref": "#/definitions/version" }
  27508. },
  27509. "version": {
  27510. "type": "object",
  27511. "oneOf": [
  27512. { "$ref": "#/definitions/package" },
  27513. { "$ref": "#/definitions/metapackage" }
  27514. ]
  27515. },
  27516. "package-base": {
  27517. "properties": {
  27518. "name": { "type": "string" },
  27519. "type": { "type": "string" },
  27520. "version": { "type": "string" },
  27521. "version_normalized": {
  27522. "type": "string",
  27523. "description": "Normalized version, optional but can save computational time on client side."
  27524. },
  27525. "autoload": { "type": "object" },
  27526. "require": { "type": "object" },
  27527. "replace": { "type": "object" },
  27528. "conflict": { "type": "object" },
  27529. "provide": { "type": "object" },
  27530. "time": { "type": "string" }
  27531. },
  27532. "additionalProperties": true
  27533. },
  27534. "package": {
  27535. "allOf": [
  27536. { "$ref": "#/definitions/package-base" },
  27537. {
  27538. "properties": {
  27539. "dist": { "type": "object" },
  27540. "source": { "type": "object" }
  27541. }
  27542. },
  27543. { "oneOf": [
  27544. { "required": [ "name", "version", "source" ] },
  27545. { "required": [ "name", "version", "dist" ] }
  27546. ] }
  27547. ]
  27548. },
  27549. "metapackage": {
  27550. "allOf": [
  27551. { "$ref": "#/definitions/package-base" },
  27552. {
  27553. "properties": {
  27554. "type": { "type": "string", "enum": [ "metapackage" ] }
  27555. },
  27556. "required": [ "name", "version", "type" ]
  27557. }
  27558. ]
  27559. },
  27560. "provider": {
  27561. "type": "object",
  27562. "properties": {
  27563. "sha256": {
  27564. "type": "string",
  27565. "description": "Hash value that can be used to validate the resource."
  27566. }
  27567. }
  27568. }
  27569. }
  27570. }
  27571. {
  27572. "$schema": "http://json-schema.org/draft-04/schema#",
  27573. "name": "Package",
  27574. "type": "object",
  27575. "additionalProperties": false,
  27576. "required": [ "name", "description" ],
  27577. "properties": {
  27578. "name": {
  27579. "type": "string",
  27580. "description": "Package name, including 'vendor-name/' prefix."
  27581. },
  27582. "type": {
  27583. "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.",
  27584. "type": "string"
  27585. },
  27586. "target-dir": {
  27587. "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.",
  27588. "type": "string"
  27589. },
  27590. "description": {
  27591. "type": "string",
  27592. "description": "Short package description."
  27593. },
  27594. "keywords": {
  27595. "type": "array",
  27596. "items": {
  27597. "type": "string",
  27598. "description": "A tag/keyword that this package relates to."
  27599. }
  27600. },
  27601. "homepage": {
  27602. "type": "string",
  27603. "description": "Homepage URL for the project.",
  27604. "format": "uri"
  27605. },
  27606. "version": {
  27607. "type": "string",
  27608. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
  27609. },
  27610. "time": {
  27611. "type": "string",
  27612. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  27613. },
  27614. "license": {
  27615. "type": ["string", "array"],
  27616. "description": "License name. Or an array of license names."
  27617. },
  27618. "authors": {
  27619. "$ref": "#/definitions/authors"
  27620. },
  27621. "require": {
  27622. "type": "object",
  27623. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  27624. "additionalProperties": {
  27625. "type": "string"
  27626. }
  27627. },
  27628. "replace": {
  27629. "type": "object",
  27630. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  27631. "additionalProperties": {
  27632. "type": "string"
  27633. }
  27634. },
  27635. "conflict": {
  27636. "type": "object",
  27637. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  27638. "additionalProperties": {
  27639. "type": "string"
  27640. }
  27641. },
  27642. "provide": {
  27643. "type": "object",
  27644. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  27645. "additionalProperties": {
  27646. "type": "string"
  27647. }
  27648. },
  27649. "require-dev": {
  27650. "type": "object",
  27651. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  27652. "additionalProperties": {
  27653. "type": "string"
  27654. }
  27655. },
  27656. "suggest": {
  27657. "type": "object",
  27658. "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).",
  27659. "additionalProperties": {
  27660. "type": "string"
  27661. }
  27662. },
  27663. "config": {
  27664. "type": "object",
  27665. "description": "Composer options.",
  27666. "properties": {
  27667. "process-timeout": {
  27668. "type": "integer",
  27669. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  27670. },
  27671. "use-include-path": {
  27672. "type": "boolean",
  27673. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  27674. },
  27675. "preferred-install": {
  27676. "type": ["string", "object"],
  27677. "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\"}."
  27678. },
  27679. "notify-on-install": {
  27680. "type": "boolean",
  27681. "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."
  27682. },
  27683. "github-protocols": {
  27684. "type": "array",
  27685. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  27686. "items": {
  27687. "type": "string"
  27688. }
  27689. },
  27690. "github-oauth": {
  27691. "type": "object",
  27692. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  27693. "additionalProperties": {
  27694. "type": "string"
  27695. }
  27696. },
  27697. "gitlab-oauth": {
  27698. "type": "object",
  27699. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  27700. "additionalProperties": {
  27701. "type": "string"
  27702. }
  27703. },
  27704. "gitlab-token": {
  27705. "type": "object",
  27706. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  27707. "additionalProperties": true
  27708. },
  27709. "disable-tls": {
  27710. "type": "boolean",
  27711. "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."
  27712. },
  27713. "secure-http": {
  27714. "type": "boolean",
  27715. "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."
  27716. },
  27717. "cafile": {
  27718. "type": "string",
  27719. "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."
  27720. },
  27721. "capath": {
  27722. "type": "string",
  27723. "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."
  27724. },
  27725. "http-basic": {
  27726. "type": "object",
  27727. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  27728. "additionalProperties": {
  27729. "type": "object",
  27730. "required": ["username", "password"],
  27731. "properties": {
  27732. "username": {
  27733. "type": "string",
  27734. "description": "The username used for HTTP Basic authentication"
  27735. },
  27736. "password": {
  27737. "type": "string",
  27738. "description": "The password used for HTTP Basic authentication"
  27739. }
  27740. }
  27741. }
  27742. },
  27743. "store-auths": {
  27744. "type": ["string", "boolean"],
  27745. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  27746. },
  27747. "platform": {
  27748. "type": "object",
  27749. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  27750. "additionalProperties": {
  27751. "type": "string"
  27752. }
  27753. },
  27754. "vendor-dir": {
  27755. "type": "string",
  27756. "description": "The location where all packages are installed, defaults to \"vendor\"."
  27757. },
  27758. "bin-dir": {
  27759. "type": "string",
  27760. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  27761. },
  27762. "data-dir": {
  27763. "type": "string",
  27764. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  27765. },
  27766. "cache-dir": {
  27767. "type": "string",
  27768. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  27769. },
  27770. "cache-files-dir": {
  27771. "type": "string",
  27772. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  27773. },
  27774. "cache-repo-dir": {
  27775. "type": "string",
  27776. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  27777. },
  27778. "cache-vcs-dir": {
  27779. "type": "string",
  27780. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  27781. },
  27782. "cache-ttl": {
  27783. "type": "integer",
  27784. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  27785. },
  27786. "cache-files-ttl": {
  27787. "type": "integer",
  27788. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  27789. },
  27790. "cache-files-maxsize": {
  27791. "type": ["string", "integer"],
  27792. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  27793. },
  27794. "bin-compat": {
  27795. "enum": ["auto", "full"],
  27796. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  27797. },
  27798. "discard-changes": {
  27799. "type": ["string", "boolean"],
  27800. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  27801. },
  27802. "autoloader-suffix": {
  27803. "type": "string",
  27804. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  27805. },
  27806. "optimize-autoloader": {
  27807. "type": "boolean",
  27808. "description": "Always optimize when dumping the autoloader."
  27809. },
  27810. "prepend-autoloader": {
  27811. "type": "boolean",
  27812. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  27813. },
  27814. "classmap-authoritative": {
  27815. "type": "boolean",
  27816. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  27817. },
  27818. "apcu-autoloader": {
  27819. "type": "boolean",
  27820. "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."
  27821. },
  27822. "github-domains": {
  27823. "type": "array",
  27824. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  27825. "items": {
  27826. "type": "string"
  27827. }
  27828. },
  27829. "github-expose-hostname": {
  27830. "type": "boolean",
  27831. "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."
  27832. },
  27833. "gitlab-domains": {
  27834. "type": "array",
  27835. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  27836. "items": {
  27837. "type": "string"
  27838. }
  27839. },
  27840. "archive-format": {
  27841. "type": "string",
  27842. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  27843. },
  27844. "archive-dir": {
  27845. "type": "string",
  27846. "description": "The default archive path when not provided on cli, defaults to \".\"."
  27847. },
  27848. "htaccess-protect": {
  27849. "type": "boolean",
  27850. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  27851. },
  27852. "sort-packages": {
  27853. "type": "boolean",
  27854. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  27855. }
  27856. }
  27857. },
  27858. "extra": {
  27859. "type": ["object", "array"],
  27860. "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.",
  27861. "additionalProperties": true
  27862. },
  27863. "autoload": {
  27864. "$ref": "#/definitions/autoload"
  27865. },
  27866. "autoload-dev": {
  27867. "type": "object",
  27868. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  27869. "properties": {
  27870. "psr-0": {
  27871. "type": "object",
  27872. "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.",
  27873. "additionalProperties": {
  27874. "type": ["string", "array"],
  27875. "items": {
  27876. "type": "string"
  27877. }
  27878. }
  27879. },
  27880. "psr-4": {
  27881. "type": "object",
  27882. "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.",
  27883. "additionalProperties": {
  27884. "type": ["string", "array"],
  27885. "items": {
  27886. "type": "string"
  27887. }
  27888. }
  27889. },
  27890. "classmap": {
  27891. "type": "array",
  27892. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  27893. },
  27894. "files": {
  27895. "type": "array",
  27896. "description": "This is an array of files that are always required on every request."
  27897. }
  27898. }
  27899. },
  27900. "archive": {
  27901. "type": ["object"],
  27902. "description": "Options for creating package archives for distribution.",
  27903. "properties": {
  27904. "exclude": {
  27905. "type": "array",
  27906. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  27907. }
  27908. }
  27909. },
  27910. "repositories": {
  27911. "type": ["object", "array"],
  27912. "description": "A set of additional repositories where packages can be found.",
  27913. "additionalProperties": {
  27914. "oneOf": [
  27915. { "$ref": "#/definitions/repository" },
  27916. { "type": "boolean", "enum": [false] }
  27917. ]
  27918. },
  27919. "items": {
  27920. "oneOf": [
  27921. { "$ref": "#/definitions/repository" },
  27922. {
  27923. "type": "object",
  27924. "additionalProperties": { "type": "boolean", "enum": [false] },
  27925. "minProperties": 1,
  27926. "maxProperties": 1
  27927. }
  27928. ]
  27929. }
  27930. },
  27931. "minimum-stability": {
  27932. "type": ["string"],
  27933. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  27934. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  27935. },
  27936. "prefer-stable": {
  27937. "type": ["boolean"],
  27938. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  27939. },
  27940. "bin": {
  27941. "type": ["string", "array"],
  27942. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  27943. "items": {
  27944. "type": "string"
  27945. }
  27946. },
  27947. "include-path": {
  27948. "type": ["array"],
  27949. "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.",
  27950. "items": {
  27951. "type": "string"
  27952. }
  27953. },
  27954. "scripts": {
  27955. "type": ["object"],
  27956. "description": "Script listeners that will be executed before/after some events.",
  27957. "properties": {
  27958. "pre-install-cmd": {
  27959. "type": ["array", "string"],
  27960. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  27961. },
  27962. "post-install-cmd": {
  27963. "type": ["array", "string"],
  27964. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  27965. },
  27966. "pre-update-cmd": {
  27967. "type": ["array", "string"],
  27968. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  27969. },
  27970. "post-update-cmd": {
  27971. "type": ["array", "string"],
  27972. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  27973. },
  27974. "pre-status-cmd": {
  27975. "type": ["array", "string"],
  27976. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  27977. },
  27978. "post-status-cmd": {
  27979. "type": ["array", "string"],
  27980. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  27981. },
  27982. "pre-package-install": {
  27983. "type": ["array", "string"],
  27984. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  27985. },
  27986. "post-package-install": {
  27987. "type": ["array", "string"],
  27988. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  27989. },
  27990. "pre-package-update": {
  27991. "type": ["array", "string"],
  27992. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  27993. },
  27994. "post-package-update": {
  27995. "type": ["array", "string"],
  27996. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  27997. },
  27998. "pre-package-uninstall": {
  27999. "type": ["array", "string"],
  28000. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  28001. },
  28002. "post-package-uninstall": {
  28003. "type": ["array", "string"],
  28004. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  28005. },
  28006. "pre-autoload-dump": {
  28007. "type": ["array", "string"],
  28008. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  28009. },
  28010. "post-autoload-dump": {
  28011. "type": ["array", "string"],
  28012. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  28013. },
  28014. "post-root-package-install": {
  28015. "type": ["array", "string"],
  28016. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  28017. },
  28018. "post-create-project-cmd": {
  28019. "type": ["array", "string"],
  28020. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  28021. }
  28022. }
  28023. },
  28024. "scripts-descriptions": {
  28025. "type": ["object"],
  28026. "description": "Descriptions for custom commands, shown in console help.",
  28027. "additionalProperties": {
  28028. "type": "string"
  28029. }
  28030. },
  28031. "support": {
  28032. "type": "object",
  28033. "properties": {
  28034. "email": {
  28035. "type": "string",
  28036. "description": "Email address for support.",
  28037. "format": "email"
  28038. },
  28039. "issues": {
  28040. "type": "string",
  28041. "description": "URL to the issue tracker.",
  28042. "format": "uri"
  28043. },
  28044. "forum": {
  28045. "type": "string",
  28046. "description": "URL to the forum.",
  28047. "format": "uri"
  28048. },
  28049. "wiki": {
  28050. "type": "string",
  28051. "description": "URL to the wiki.",
  28052. "format": "uri"
  28053. },
  28054. "irc": {
  28055. "type": "string",
  28056. "description": "IRC channel for support, as irc://server/channel.",
  28057. "format": "uri"
  28058. },
  28059. "source": {
  28060. "type": "string",
  28061. "description": "URL to browse or download the sources.",
  28062. "format": "uri"
  28063. },
  28064. "docs": {
  28065. "type": "string",
  28066. "description": "URL to the documentation.",
  28067. "format": "uri"
  28068. },
  28069. "rss": {
  28070. "type": "string",
  28071. "description": "URL to the RSS feed.",
  28072. "format": "uri"
  28073. }
  28074. }
  28075. },
  28076. "non-feature-branches": {
  28077. "type": ["array"],
  28078. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  28079. "items": {
  28080. "type": "string"
  28081. }
  28082. },
  28083. "abandoned": {
  28084. "type": ["boolean", "string"],
  28085. "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."
  28086. },
  28087. "_comment": {
  28088. "type": ["array", "string"],
  28089. "description": "A key to store comments in"
  28090. }
  28091. },
  28092. "definitions": {
  28093. "authors": {
  28094. "type": "array",
  28095. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  28096. "items": {
  28097. "type": "object",
  28098. "additionalProperties": false,
  28099. "required": [ "name"],
  28100. "properties": {
  28101. "name": {
  28102. "type": "string",
  28103. "description": "Full name of the author."
  28104. },
  28105. "email": {
  28106. "type": "string",
  28107. "description": "Email address of the author.",
  28108. "format": "email"
  28109. },
  28110. "homepage": {
  28111. "type": "string",
  28112. "description": "Homepage URL for the author.",
  28113. "format": "uri"
  28114. },
  28115. "role": {
  28116. "type": "string",
  28117. "description": "Author's role in the project."
  28118. }
  28119. }
  28120. }
  28121. },
  28122. "autoload": {
  28123. "type": "object",
  28124. "description": "Description of how the package can be autoloaded.",
  28125. "properties": {
  28126. "psr-0": {
  28127. "type": "object",
  28128. "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.",
  28129. "additionalProperties": {
  28130. "type": ["string", "array"],
  28131. "items": {
  28132. "type": "string"
  28133. }
  28134. }
  28135. },
  28136. "psr-4": {
  28137. "type": "object",
  28138. "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.",
  28139. "additionalProperties": {
  28140. "type": ["string", "array"],
  28141. "items": {
  28142. "type": "string"
  28143. }
  28144. }
  28145. },
  28146. "classmap": {
  28147. "type": "array",
  28148. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  28149. },
  28150. "files": {
  28151. "type": "array",
  28152. "description": "This is an array of files that are always required on every request."
  28153. },
  28154. "exclude-from-classmap": {
  28155. "type": "array",
  28156. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  28157. }
  28158. }
  28159. },
  28160. "repository": {
  28161. "type": "object",
  28162. "oneOf": [
  28163. { "$ref": "#/definitions/composer-repository" },
  28164. { "$ref": "#/definitions/vcs-repository" },
  28165. { "$ref": "#/definitions/path-repository" },
  28166. { "$ref": "#/definitions/artifact-repository" },
  28167. { "$ref": "#/definitions/pear-repository" },
  28168. { "$ref": "#/definitions/package-repository" }
  28169. ]
  28170. },
  28171. "composer-repository": {
  28172. "type": "object",
  28173. "required": ["type", "url"],
  28174. "properties": {
  28175. "type": { "type": "string", "enum": ["composer"] },
  28176. "url": { "type": "string" },
  28177. "options": {
  28178. "type": "object",
  28179. "additionalProperties": true
  28180. },
  28181. "allow_ssl_downgrade": { "type": "boolean" },
  28182. "force-lazy-providers": { "type": "boolean" }
  28183. }
  28184. },
  28185. "vcs-repository": {
  28186. "type": "object",
  28187. "required": ["type", "url"],
  28188. "properties": {
  28189. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  28190. "url": { "type": "string" },
  28191. "no-api": { "type": "boolean" },
  28192. "secure-http": { "type": "boolean" },
  28193. "svn-cache-credentials": { "type": "boolean" },
  28194. "trunk-path": { "type": ["string", "boolean"] },
  28195. "branches-path": { "type": ["string", "boolean"] },
  28196. "tags-path": { "type": ["string", "boolean"] },
  28197. "package-path": { "type": "string" },
  28198. "depot": { "type": "string" },
  28199. "branch": { "type": "string" },
  28200. "unique_perforce_client_name": { "type": "string" },
  28201. "p4user": { "type": "string" },
  28202. "p4password": { "type": "string" }
  28203. }
  28204. },
  28205. "path-repository": {
  28206. "type": "object",
  28207. "required": ["type", "url"],
  28208. "properties": {
  28209. "type": { "type": "string", "enum": ["path"] },
  28210. "url": { "type": "string" },
  28211. "options": {
  28212. "type": "object",
  28213. "properties": {
  28214. "symlink": { "type": ["boolean", "null"] }
  28215. },
  28216. "additionalProperties": true
  28217. }
  28218. }
  28219. },
  28220. "artifact-repository": {
  28221. "type": "object",
  28222. "required": ["type", "url"],
  28223. "properties": {
  28224. "type": { "type": "string", "enum": ["artifact"] },
  28225. "url": { "type": "string" }
  28226. }
  28227. },
  28228. "pear-repository": {
  28229. "type": "object",
  28230. "required": ["type", "url"],
  28231. "properties": {
  28232. "type": { "type": "string", "enum": ["pear"] },
  28233. "url": { "type": "string" },
  28234. "vendor-alias": { "type": "string" }
  28235. }
  28236. },
  28237. "package-repository": {
  28238. "type": "object",
  28239. "required": ["type", "package"],
  28240. "properties": {
  28241. "type": { "type": "string", "enum": ["package"] },
  28242. "package": {
  28243. "oneOf": [
  28244. { "$ref": "#/definitions/inline-package" },
  28245. {
  28246. "type": "array",
  28247. "items": {
  28248. "type": { "$ref": "#/definitions/inline-package" }
  28249. }
  28250. }
  28251. ]
  28252. }
  28253. }
  28254. },
  28255. "inline-package": {
  28256. "required": ["name", "version"],
  28257. "properties": {
  28258. "name": {
  28259. "type": "string",
  28260. "description": "Package name, including 'vendor-name/' prefix."
  28261. },
  28262. "type": {
  28263. "type": "string"
  28264. },
  28265. "target-dir": {
  28266. "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.",
  28267. "type": "string"
  28268. },
  28269. "description": {
  28270. "type": "string"
  28271. },
  28272. "keywords": {
  28273. "type": "array",
  28274. "items": {
  28275. "type": "string"
  28276. }
  28277. },
  28278. "homepage": {
  28279. "type": "string",
  28280. "format": "uri"
  28281. },
  28282. "version": {
  28283. "type": "string"
  28284. },
  28285. "time": {
  28286. "type": "string"
  28287. },
  28288. "license": {
  28289. "type": [
  28290. "string",
  28291. "array"
  28292. ]
  28293. },
  28294. "authors": {
  28295. "$ref": "#/definitions/authors"
  28296. },
  28297. "require": {
  28298. "type": "object",
  28299. "additionalProperties": {
  28300. "type": "string"
  28301. }
  28302. },
  28303. "replace": {
  28304. "type": "object",
  28305. "additionalProperties": {
  28306. "type": "string"
  28307. }
  28308. },
  28309. "conflict": {
  28310. "type": "object",
  28311. "additionalProperties": {
  28312. "type": "string"
  28313. }
  28314. },
  28315. "provide": {
  28316. "type": "object",
  28317. "additionalProperties": {
  28318. "type": "string"
  28319. }
  28320. },
  28321. "require-dev": {
  28322. "type": "object",
  28323. "additionalProperties": {
  28324. "type": "string"
  28325. }
  28326. },
  28327. "suggest": {
  28328. "type": "object",
  28329. "additionalProperties": {
  28330. "type": "string"
  28331. }
  28332. },
  28333. "extra": {
  28334. "type": ["object", "array"],
  28335. "additionalProperties": true
  28336. },
  28337. "autoload": {
  28338. "$ref": "#/definitions/autoload"
  28339. },
  28340. "archive": {
  28341. "type": ["object"],
  28342. "properties": {
  28343. "exclude": {
  28344. "type": "array"
  28345. }
  28346. }
  28347. },
  28348. "bin": {
  28349. "type": ["string", "array"],
  28350. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  28351. "items": {
  28352. "type": "string"
  28353. }
  28354. },
  28355. "include-path": {
  28356. "type": ["array"],
  28357. "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.",
  28358. "items": {
  28359. "type": "string"
  28360. }
  28361. },
  28362. "source": {
  28363. "type": "object",
  28364. "required": ["type", "url", "reference"],
  28365. "properties": {
  28366. "type": {
  28367. "type": "string"
  28368. },
  28369. "url": {
  28370. "type": "string"
  28371. },
  28372. "reference": {
  28373. "type": "string"
  28374. },
  28375. "mirrors": {
  28376. "type": "array"
  28377. }
  28378. }
  28379. },
  28380. "dist": {
  28381. "type": "object",
  28382. "required": ["type", "url"],
  28383. "properties": {
  28384. "type": {
  28385. "type": "string"
  28386. },
  28387. "url": {
  28388. "type": "string"
  28389. },
  28390. "reference": {
  28391. "type": "string"
  28392. },
  28393. "shasum": {
  28394. "type": "string"
  28395. },
  28396. "mirrors": {
  28397. "type": "array"
  28398. }
  28399. }
  28400. }
  28401. },
  28402. "additionalProperties": true
  28403. }
  28404. }
  28405. }
  28406. {
  28407. "389-exception": [
  28408. "389 Directory Server Exception"
  28409. ],
  28410. "Autoconf-exception-2.0": [
  28411. "Autoconf exception 2.0"
  28412. ],
  28413. "Autoconf-exception-3.0": [
  28414. "Autoconf exception 3.0"
  28415. ],
  28416. "Bison-exception-2.2": [
  28417. "Bison exception 2.2"
  28418. ],
  28419. "Bootloader-exception": [
  28420. "Bootloader Distribution Exception"
  28421. ],
  28422. "Classpath-exception-2.0": [
  28423. "Classpath exception 2.0"
  28424. ],
  28425. "CLISP-exception-2.0": [
  28426. "CLISP exception 2.0"
  28427. ],
  28428. "DigiRule-FOSS-exception": [
  28429. "DigiRule FOSS License Exception"
  28430. ],
  28431. "eCos-exception-2.0": [
  28432. "eCos exception 2.0"
  28433. ],
  28434. "Fawkes-Runtime-exception": [
  28435. "Fawkes Runtime Exception"
  28436. ],
  28437. "FLTK-exception": [
  28438. "FLTK exception"
  28439. ],
  28440. "Font-exception-2.0": [
  28441. "Font exception 2.0"
  28442. ],
  28443. "freertos-exception-2.0": [
  28444. "FreeRTOS Exception 2.0"
  28445. ],
  28446. "GCC-exception-2.0": [
  28447. "GCC Runtime Library exception 2.0"
  28448. ],
  28449. "GCC-exception-3.1": [
  28450. "GCC Runtime Library exception 3.1"
  28451. ],
  28452. "gnu-javamail-exception": [
  28453. "GNU JavaMail exception"
  28454. ],
  28455. "i2p-gpl-java-exception": [
  28456. "i2p GPL+Java Exception"
  28457. ],
  28458. "Libtool-exception": [
  28459. "Libtool Exception"
  28460. ],
  28461. "Linux-syscall-note": [
  28462. "Linux Syscall Note"
  28463. ],
  28464. "LZMA-exception": [
  28465. "LZMA exception"
  28466. ],
  28467. "mif-exception": [
  28468. "Macros and Inline Functions Exception"
  28469. ],
  28470. "Nokia-Qt-exception-1.1": [
  28471. "Nokia Qt LGPL exception 1.1"
  28472. ],
  28473. "OCCT-exception-1.0": [
  28474. "Open CASCADE Exception 1.0"
  28475. ],
  28476. "openvpn-openssl-exception": [
  28477. "OpenVPN OpenSSL Exception"
  28478. ],
  28479. "Qwt-exception-1.0": [
  28480. "Qwt exception 1.0"
  28481. ],
  28482. "u-boot-exception-2.0": [
  28483. "U-Boot exception 2.0"
  28484. ],
  28485. "WxWindows-exception-3.1": [
  28486. "WxWindows Library Exception 3.1"
  28487. ]
  28488. }{
  28489. "0BSD": [
  28490. "BSD Zero Clause License",
  28491. false,
  28492. false
  28493. ],
  28494. "AAL": [
  28495. "Attribution Assurance License",
  28496. true,
  28497. false
  28498. ],
  28499. "Abstyles": [
  28500. "Abstyles License",
  28501. false,
  28502. false
  28503. ],
  28504. "Adobe-2006": [
  28505. "Adobe Systems Incorporated Source Code License Agreement",
  28506. false,
  28507. false
  28508. ],
  28509. "Adobe-Glyph": [
  28510. "Adobe Glyph List License",
  28511. false,
  28512. false
  28513. ],
  28514. "ADSL": [
  28515. "Amazon Digital Services License",
  28516. false,
  28517. false
  28518. ],
  28519. "AFL-1.1": [
  28520. "Academic Free License v1.1",
  28521. true,
  28522. false
  28523. ],
  28524. "AFL-1.2": [
  28525. "Academic Free License v1.2",
  28526. true,
  28527. false
  28528. ],
  28529. "AFL-2.0": [
  28530. "Academic Free License v2.0",
  28531. true,
  28532. false
  28533. ],
  28534. "AFL-2.1": [
  28535. "Academic Free License v2.1",
  28536. true,
  28537. false
  28538. ],
  28539. "AFL-3.0": [
  28540. "Academic Free License v3.0",
  28541. true,
  28542. false
  28543. ],
  28544. "Afmparse": [
  28545. "Afmparse License",
  28546. false,
  28547. false
  28548. ],
  28549. "AGPL-1.0": [
  28550. "Affero General Public License v1.0",
  28551. false,
  28552. false
  28553. ],
  28554. "AGPL-3.0": [
  28555. "GNU Affero General Public License v3.0",
  28556. true,
  28557. true
  28558. ],
  28559. "AGPL-3.0-only": [
  28560. "GNU Affero General Public License v3.0 only",
  28561. true,
  28562. false
  28563. ],
  28564. "AGPL-3.0-or-later": [
  28565. "GNU Affero General Public License v3.0 or later",
  28566. true,
  28567. false
  28568. ],
  28569. "Aladdin": [
  28570. "Aladdin Free Public License",
  28571. false,
  28572. false
  28573. ],
  28574. "AMDPLPA": [
  28575. "AMD's plpa_map.c License",
  28576. false,
  28577. false
  28578. ],
  28579. "AML": [
  28580. "Apple MIT License",
  28581. false,
  28582. false
  28583. ],
  28584. "AMPAS": [
  28585. "Academy of Motion Picture Arts and Sciences BSD",
  28586. false,
  28587. false
  28588. ],
  28589. "ANTLR-PD": [
  28590. "ANTLR Software Rights Notice",
  28591. false,
  28592. false
  28593. ],
  28594. "Apache-1.0": [
  28595. "Apache License 1.0",
  28596. false,
  28597. false
  28598. ],
  28599. "Apache-1.1": [
  28600. "Apache License 1.1",
  28601. true,
  28602. false
  28603. ],
  28604. "Apache-2.0": [
  28605. "Apache License 2.0",
  28606. true,
  28607. false
  28608. ],
  28609. "APAFML": [
  28610. "Adobe Postscript AFM License",
  28611. false,
  28612. false
  28613. ],
  28614. "APL-1.0": [
  28615. "Adaptive Public License 1.0",
  28616. true,
  28617. false
  28618. ],
  28619. "APSL-1.0": [
  28620. "Apple Public Source License 1.0",
  28621. true,
  28622. false
  28623. ],
  28624. "APSL-1.1": [
  28625. "Apple Public Source License 1.1",
  28626. true,
  28627. false
  28628. ],
  28629. "APSL-1.2": [
  28630. "Apple Public Source License 1.2",
  28631. true,
  28632. false
  28633. ],
  28634. "APSL-2.0": [
  28635. "Apple Public Source License 2.0",
  28636. true,
  28637. false
  28638. ],
  28639. "Artistic-1.0": [
  28640. "Artistic License 1.0",
  28641. true,
  28642. false
  28643. ],
  28644. "Artistic-1.0-cl8": [
  28645. "Artistic License 1.0 w/clause 8",
  28646. true,
  28647. false
  28648. ],
  28649. "Artistic-1.0-Perl": [
  28650. "Artistic License 1.0 (Perl)",
  28651. true,
  28652. false
  28653. ],
  28654. "Artistic-2.0": [
  28655. "Artistic License 2.0",
  28656. true,
  28657. false
  28658. ],
  28659. "Bahyph": [
  28660. "Bahyph License",
  28661. false,
  28662. false
  28663. ],
  28664. "Barr": [
  28665. "Barr License",
  28666. false,
  28667. false
  28668. ],
  28669. "Beerware": [
  28670. "Beerware License",
  28671. false,
  28672. false
  28673. ],
  28674. "BitTorrent-1.0": [
  28675. "BitTorrent Open Source License v1.0",
  28676. false,
  28677. false
  28678. ],
  28679. "BitTorrent-1.1": [
  28680. "BitTorrent Open Source License v1.1",
  28681. false,
  28682. false
  28683. ],
  28684. "Borceux": [
  28685. "Borceux license",
  28686. false,
  28687. false
  28688. ],
  28689. "BSD-1-Clause": [
  28690. "BSD 1-Clause License",
  28691. false,
  28692. false
  28693. ],
  28694. "BSD-2-Clause": [
  28695. "BSD 2-Clause \"Simplified\" License",
  28696. true,
  28697. false
  28698. ],
  28699. "BSD-2-Clause-FreeBSD": [
  28700. "BSD 2-Clause FreeBSD License",
  28701. false,
  28702. false
  28703. ],
  28704. "BSD-2-Clause-NetBSD": [
  28705. "BSD 2-Clause NetBSD License",
  28706. false,
  28707. false
  28708. ],
  28709. "BSD-2-Clause-Patent": [
  28710. "BSD-2-Clause Plus Patent License",
  28711. true,
  28712. false
  28713. ],
  28714. "BSD-3-Clause": [
  28715. "BSD 3-Clause \"New\" or \"Revised\" License",
  28716. true,
  28717. false
  28718. ],
  28719. "BSD-3-Clause-Attribution": [
  28720. "BSD with attribution",
  28721. false,
  28722. false
  28723. ],
  28724. "BSD-3-Clause-Clear": [
  28725. "BSD 3-Clause Clear License",
  28726. false,
  28727. false
  28728. ],
  28729. "BSD-3-Clause-LBNL": [
  28730. "Lawrence Berkeley National Labs BSD variant license",
  28731. false,
  28732. false
  28733. ],
  28734. "BSD-3-Clause-No-Nuclear-License": [
  28735. "BSD 3-Clause No Nuclear License",
  28736. false,
  28737. false
  28738. ],
  28739. "BSD-3-Clause-No-Nuclear-License-2014": [
  28740. "BSD 3-Clause No Nuclear License 2014",
  28741. false,
  28742. false
  28743. ],
  28744. "BSD-3-Clause-No-Nuclear-Warranty": [
  28745. "BSD 3-Clause No Nuclear Warranty",
  28746. false,
  28747. false
  28748. ],
  28749. "BSD-4-Clause": [
  28750. "BSD 4-Clause \"Original\" or \"Old\" License",
  28751. false,
  28752. false
  28753. ],
  28754. "BSD-4-Clause-UC": [
  28755. "BSD-4-Clause (University of California-Specific)",
  28756. false,
  28757. false
  28758. ],
  28759. "BSD-Protection": [
  28760. "BSD Protection License",
  28761. false,
  28762. false
  28763. ],
  28764. "BSD-Source-Code": [
  28765. "BSD Source Code Attribution",
  28766. false,
  28767. false
  28768. ],
  28769. "BSL-1.0": [
  28770. "Boost Software License 1.0",
  28771. true,
  28772. false
  28773. ],
  28774. "bzip2-1.0.5": [
  28775. "bzip2 and libbzip2 License v1.0.5",
  28776. false,
  28777. false
  28778. ],
  28779. "bzip2-1.0.6": [
  28780. "bzip2 and libbzip2 License v1.0.6",
  28781. false,
  28782. false
  28783. ],
  28784. "Caldera": [
  28785. "Caldera License",
  28786. false,
  28787. false
  28788. ],
  28789. "CATOSL-1.1": [
  28790. "Computer Associates Trusted Open Source License 1.1",
  28791. true,
  28792. false
  28793. ],
  28794. "CC-BY-1.0": [
  28795. "Creative Commons Attribution 1.0",
  28796. false,
  28797. false
  28798. ],
  28799. "CC-BY-2.0": [
  28800. "Creative Commons Attribution 2.0",
  28801. false,
  28802. false
  28803. ],
  28804. "CC-BY-2.5": [
  28805. "Creative Commons Attribution 2.5",
  28806. false,
  28807. false
  28808. ],
  28809. "CC-BY-3.0": [
  28810. "Creative Commons Attribution 3.0",
  28811. false,
  28812. false
  28813. ],
  28814. "CC-BY-4.0": [
  28815. "Creative Commons Attribution 4.0",
  28816. false,
  28817. false
  28818. ],
  28819. "CC-BY-NC-1.0": [
  28820. "Creative Commons Attribution Non Commercial 1.0",
  28821. false,
  28822. false
  28823. ],
  28824. "CC-BY-NC-2.0": [
  28825. "Creative Commons Attribution Non Commercial 2.0",
  28826. false,
  28827. false
  28828. ],
  28829. "CC-BY-NC-2.5": [
  28830. "Creative Commons Attribution Non Commercial 2.5",
  28831. false,
  28832. false
  28833. ],
  28834. "CC-BY-NC-3.0": [
  28835. "Creative Commons Attribution Non Commercial 3.0",
  28836. false,
  28837. false
  28838. ],
  28839. "CC-BY-NC-4.0": [
  28840. "Creative Commons Attribution Non Commercial 4.0",
  28841. false,
  28842. false
  28843. ],
  28844. "CC-BY-NC-ND-1.0": [
  28845. "Creative Commons Attribution Non Commercial No Derivatives 1.0",
  28846. false,
  28847. false
  28848. ],
  28849. "CC-BY-NC-ND-2.0": [
  28850. "Creative Commons Attribution Non Commercial No Derivatives 2.0",
  28851. false,
  28852. false
  28853. ],
  28854. "CC-BY-NC-ND-2.5": [
  28855. "Creative Commons Attribution Non Commercial No Derivatives 2.5",
  28856. false,
  28857. false
  28858. ],
  28859. "CC-BY-NC-ND-3.0": [
  28860. "Creative Commons Attribution Non Commercial No Derivatives 3.0",
  28861. false,
  28862. false
  28863. ],
  28864. "CC-BY-NC-ND-4.0": [
  28865. "Creative Commons Attribution Non Commercial No Derivatives 4.0",
  28866. false,
  28867. false
  28868. ],
  28869. "CC-BY-NC-SA-1.0": [
  28870. "Creative Commons Attribution Non Commercial Share Alike 1.0",
  28871. false,
  28872. false
  28873. ],
  28874. "CC-BY-NC-SA-2.0": [
  28875. "Creative Commons Attribution Non Commercial Share Alike 2.0",
  28876. false,
  28877. false
  28878. ],
  28879. "CC-BY-NC-SA-2.5": [
  28880. "Creative Commons Attribution Non Commercial Share Alike 2.5",
  28881. false,
  28882. false
  28883. ],
  28884. "CC-BY-NC-SA-3.0": [
  28885. "Creative Commons Attribution Non Commercial Share Alike 3.0",
  28886. false,
  28887. false
  28888. ],
  28889. "CC-BY-NC-SA-4.0": [
  28890. "Creative Commons Attribution Non Commercial Share Alike 4.0",
  28891. false,
  28892. false
  28893. ],
  28894. "CC-BY-ND-1.0": [
  28895. "Creative Commons Attribution No Derivatives 1.0",
  28896. false,
  28897. false
  28898. ],
  28899. "CC-BY-ND-2.0": [
  28900. "Creative Commons Attribution No Derivatives 2.0",
  28901. false,
  28902. false
  28903. ],
  28904. "CC-BY-ND-2.5": [
  28905. "Creative Commons Attribution No Derivatives 2.5",
  28906. false,
  28907. false
  28908. ],
  28909. "CC-BY-ND-3.0": [
  28910. "Creative Commons Attribution No Derivatives 3.0",
  28911. false,
  28912. false
  28913. ],
  28914. "CC-BY-ND-4.0": [
  28915. "Creative Commons Attribution No Derivatives 4.0",
  28916. false,
  28917. false
  28918. ],
  28919. "CC-BY-SA-1.0": [
  28920. "Creative Commons Attribution Share Alike 1.0",
  28921. false,
  28922. false
  28923. ],
  28924. "CC-BY-SA-2.0": [
  28925. "Creative Commons Attribution Share Alike 2.0",
  28926. false,
  28927. false
  28928. ],
  28929. "CC-BY-SA-2.5": [
  28930. "Creative Commons Attribution Share Alike 2.5",
  28931. false,
  28932. false
  28933. ],
  28934. "CC-BY-SA-3.0": [
  28935. "Creative Commons Attribution Share Alike 3.0",
  28936. false,
  28937. false
  28938. ],
  28939. "CC-BY-SA-4.0": [
  28940. "Creative Commons Attribution Share Alike 4.0",
  28941. false,
  28942. false
  28943. ],
  28944. "CC0-1.0": [
  28945. "Creative Commons Zero v1.0 Universal",
  28946. false,
  28947. false
  28948. ],
  28949. "CDDL-1.0": [
  28950. "Common Development and Distribution License 1.0",
  28951. true,
  28952. false
  28953. ],
  28954. "CDDL-1.1": [
  28955. "Common Development and Distribution License 1.1",
  28956. false,
  28957. false
  28958. ],
  28959. "CDLA-Permissive-1.0": [
  28960. "Community Data License Agreement Permissive 1.0",
  28961. false,
  28962. false
  28963. ],
  28964. "CDLA-Sharing-1.0": [
  28965. "Community Data License Agreement Sharing 1.0",
  28966. false,
  28967. false
  28968. ],
  28969. "CECILL-1.0": [
  28970. "CeCILL Free Software License Agreement v1.0",
  28971. false,
  28972. false
  28973. ],
  28974. "CECILL-1.1": [
  28975. "CeCILL Free Software License Agreement v1.1",
  28976. false,
  28977. false
  28978. ],
  28979. "CECILL-2.0": [
  28980. "CeCILL Free Software License Agreement v2.0",
  28981. false,
  28982. false
  28983. ],
  28984. "CECILL-2.1": [
  28985. "CeCILL Free Software License Agreement v2.1",
  28986. true,
  28987. false
  28988. ],
  28989. "CECILL-B": [
  28990. "CeCILL-B Free Software License Agreement",
  28991. false,
  28992. false
  28993. ],
  28994. "CECILL-C": [
  28995. "CeCILL-C Free Software License Agreement",
  28996. false,
  28997. false
  28998. ],
  28999. "ClArtistic": [
  29000. "Clarified Artistic License",
  29001. false,
  29002. false
  29003. ],
  29004. "CNRI-Jython": [
  29005. "CNRI Jython License",
  29006. false,
  29007. false
  29008. ],
  29009. "CNRI-Python": [
  29010. "CNRI Python License",
  29011. true,
  29012. false
  29013. ],
  29014. "CNRI-Python-GPL-Compatible": [
  29015. "CNRI Python Open Source GPL Compatible License Agreement",
  29016. false,
  29017. false
  29018. ],
  29019. "Condor-1.1": [
  29020. "Condor Public License v1.1",
  29021. false,
  29022. false
  29023. ],
  29024. "CPAL-1.0": [
  29025. "Common Public Attribution License 1.0",
  29026. true,
  29027. false
  29028. ],
  29029. "CPL-1.0": [
  29030. "Common Public License 1.0",
  29031. true,
  29032. false
  29033. ],
  29034. "CPOL-1.02": [
  29035. "Code Project Open License 1.02",
  29036. false,
  29037. false
  29038. ],
  29039. "Crossword": [
  29040. "Crossword License",
  29041. false,
  29042. false
  29043. ],
  29044. "CrystalStacker": [
  29045. "CrystalStacker License",
  29046. false,
  29047. false
  29048. ],
  29049. "CUA-OPL-1.0": [
  29050. "CUA Office Public License v1.0",
  29051. true,
  29052. false
  29053. ],
  29054. "Cube": [
  29055. "Cube License",
  29056. false,
  29057. false
  29058. ],
  29059. "curl": [
  29060. "curl License",
  29061. false,
  29062. false
  29063. ],
  29064. "D-FSL-1.0": [
  29065. "Deutsche Freie Software Lizenz",
  29066. false,
  29067. false
  29068. ],
  29069. "diffmark": [
  29070. "diffmark license",
  29071. false,
  29072. false
  29073. ],
  29074. "DOC": [
  29075. "DOC License",
  29076. false,
  29077. false
  29078. ],
  29079. "Dotseqn": [
  29080. "Dotseqn License",
  29081. false,
  29082. false
  29083. ],
  29084. "DSDP": [
  29085. "DSDP License",
  29086. false,
  29087. false
  29088. ],
  29089. "dvipdfm": [
  29090. "dvipdfm License",
  29091. false,
  29092. false
  29093. ],
  29094. "ECL-1.0": [
  29095. "Educational Community License v1.0",
  29096. true,
  29097. false
  29098. ],
  29099. "ECL-2.0": [
  29100. "Educational Community License v2.0",
  29101. true,
  29102. false
  29103. ],
  29104. "eCos-2.0": [
  29105. "eCos license version 2.0",
  29106. false,
  29107. true
  29108. ],
  29109. "EFL-1.0": [
  29110. "Eiffel Forum License v1.0",
  29111. true,
  29112. false
  29113. ],
  29114. "EFL-2.0": [
  29115. "Eiffel Forum License v2.0",
  29116. true,
  29117. false
  29118. ],
  29119. "eGenix": [
  29120. "eGenix.com Public License 1.1.0",
  29121. false,
  29122. false
  29123. ],
  29124. "Entessa": [
  29125. "Entessa Public License v1.0",
  29126. true,
  29127. false
  29128. ],
  29129. "EPL-1.0": [
  29130. "Eclipse Public License 1.0",
  29131. true,
  29132. false
  29133. ],
  29134. "EPL-2.0": [
  29135. "Eclipse Public License 2.0",
  29136. true,
  29137. false
  29138. ],
  29139. "ErlPL-1.1": [
  29140. "Erlang Public License v1.1",
  29141. false,
  29142. false
  29143. ],
  29144. "EUDatagrid": [
  29145. "EU DataGrid Software License",
  29146. true,
  29147. false
  29148. ],
  29149. "EUPL-1.0": [
  29150. "European Union Public License 1.0",
  29151. false,
  29152. false
  29153. ],
  29154. "EUPL-1.1": [
  29155. "European Union Public License 1.1",
  29156. true,
  29157. false
  29158. ],
  29159. "EUPL-1.2": [
  29160. "European Union Public License 1.2",
  29161. true,
  29162. false
  29163. ],
  29164. "Eurosym": [
  29165. "Eurosym License",
  29166. false,
  29167. false
  29168. ],
  29169. "Fair": [
  29170. "Fair License",
  29171. true,
  29172. false
  29173. ],
  29174. "Frameworx-1.0": [
  29175. "Frameworx Open License 1.0",
  29176. true,
  29177. false
  29178. ],
  29179. "FreeImage": [
  29180. "FreeImage Public License v1.0",
  29181. false,
  29182. false
  29183. ],
  29184. "FSFAP": [
  29185. "FSF All Permissive License",
  29186. false,
  29187. false
  29188. ],
  29189. "FSFUL": [
  29190. "FSF Unlimited License",
  29191. false,
  29192. false
  29193. ],
  29194. "FSFULLR": [
  29195. "FSF Unlimited License (with License Retention)",
  29196. false,
  29197. false
  29198. ],
  29199. "FTL": [
  29200. "Freetype Project License",
  29201. false,
  29202. false
  29203. ],
  29204. "GFDL-1.1": [
  29205. "GNU Free Documentation License v1.1",
  29206. false,
  29207. true
  29208. ],
  29209. "GFDL-1.1-only": [
  29210. "GNU Free Documentation License v1.1 only",
  29211. false,
  29212. false
  29213. ],
  29214. "GFDL-1.1-or-later": [
  29215. "GNU Free Documentation License v1.1 or later",
  29216. false,
  29217. false
  29218. ],
  29219. "GFDL-1.2": [
  29220. "GNU Free Documentation License v1.2",
  29221. false,
  29222. true
  29223. ],
  29224. "GFDL-1.2-only": [
  29225. "GNU Free Documentation License v1.2 only",
  29226. false,
  29227. false
  29228. ],
  29229. "GFDL-1.2-or-later": [
  29230. "GNU Free Documentation License v1.2 or later",
  29231. false,
  29232. false
  29233. ],
  29234. "GFDL-1.3": [
  29235. "GNU Free Documentation License v1.3",
  29236. false,
  29237. true
  29238. ],
  29239. "GFDL-1.3-only": [
  29240. "GNU Free Documentation License v1.3 only",
  29241. false,
  29242. false
  29243. ],
  29244. "GFDL-1.3-or-later": [
  29245. "GNU Free Documentation License v1.3 or later",
  29246. false,
  29247. false
  29248. ],
  29249. "Giftware": [
  29250. "Giftware License",
  29251. false,
  29252. false
  29253. ],
  29254. "GL2PS": [
  29255. "GL2PS License",
  29256. false,
  29257. false
  29258. ],
  29259. "Glide": [
  29260. "3dfx Glide License",
  29261. false,
  29262. false
  29263. ],
  29264. "Glulxe": [
  29265. "Glulxe License",
  29266. false,
  29267. false
  29268. ],
  29269. "gnuplot": [
  29270. "gnuplot License",
  29271. false,
  29272. false
  29273. ],
  29274. "GPL-1.0": [
  29275. "GNU General Public License v1.0 only",
  29276. false,
  29277. true
  29278. ],
  29279. "GPL-1.0+": [
  29280. "GNU General Public License v1.0 or later",
  29281. false,
  29282. true
  29283. ],
  29284. "GPL-1.0-only": [
  29285. "GNU General Public License v1.0 only",
  29286. false,
  29287. false
  29288. ],
  29289. "GPL-1.0-or-later": [
  29290. "GNU General Public License v1.0 or later",
  29291. false,
  29292. false
  29293. ],
  29294. "GPL-2.0": [
  29295. "GNU General Public License v2.0 only",
  29296. true,
  29297. true
  29298. ],
  29299. "GPL-2.0+": [
  29300. "GNU General Public License v2.0 or later",
  29301. true,
  29302. true
  29303. ],
  29304. "GPL-2.0-only": [
  29305. "GNU General Public License v2.0 only",
  29306. true,
  29307. false
  29308. ],
  29309. "GPL-2.0-or-later": [
  29310. "GNU General Public License v2.0 or later",
  29311. true,
  29312. false
  29313. ],
  29314. "GPL-2.0-with-autoconf-exception": [
  29315. "GNU General Public License v2.0 w/Autoconf exception",
  29316. false,
  29317. true
  29318. ],
  29319. "GPL-2.0-with-bison-exception": [
  29320. "GNU General Public License v2.0 w/Bison exception",
  29321. false,
  29322. true
  29323. ],
  29324. "GPL-2.0-with-classpath-exception": [
  29325. "GNU General Public License v2.0 w/Classpath exception",
  29326. false,
  29327. true
  29328. ],
  29329. "GPL-2.0-with-font-exception": [
  29330. "GNU General Public License v2.0 w/Font exception",
  29331. false,
  29332. true
  29333. ],
  29334. "GPL-2.0-with-GCC-exception": [
  29335. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  29336. false,
  29337. true
  29338. ],
  29339. "GPL-3.0": [
  29340. "GNU General Public License v3.0 only",
  29341. true,
  29342. true
  29343. ],
  29344. "GPL-3.0+": [
  29345. "GNU General Public License v3.0 or later",
  29346. true,
  29347. true
  29348. ],
  29349. "GPL-3.0-only": [
  29350. "GNU General Public License v3.0 only",
  29351. true,
  29352. false
  29353. ],
  29354. "GPL-3.0-or-later": [
  29355. "GNU General Public License v3.0 or later",
  29356. true,
  29357. false
  29358. ],
  29359. "GPL-3.0-with-autoconf-exception": [
  29360. "GNU General Public License v3.0 w/Autoconf exception",
  29361. false,
  29362. true
  29363. ],
  29364. "GPL-3.0-with-GCC-exception": [
  29365. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  29366. true,
  29367. true
  29368. ],
  29369. "gSOAP-1.3b": [
  29370. "gSOAP Public License v1.3b",
  29371. false,
  29372. false
  29373. ],
  29374. "HaskellReport": [
  29375. "Haskell Language Report License",
  29376. false,
  29377. false
  29378. ],
  29379. "HPND": [
  29380. "Historical Permission Notice and Disclaimer",
  29381. true,
  29382. false
  29383. ],
  29384. "IBM-pibs": [
  29385. "IBM PowerPC Initialization and Boot Software",
  29386. false,
  29387. false
  29388. ],
  29389. "ICU": [
  29390. "ICU License",
  29391. false,
  29392. false
  29393. ],
  29394. "IJG": [
  29395. "Independent JPEG Group License",
  29396. false,
  29397. false
  29398. ],
  29399. "ImageMagick": [
  29400. "ImageMagick License",
  29401. false,
  29402. false
  29403. ],
  29404. "iMatix": [
  29405. "iMatix Standard Function Library Agreement",
  29406. false,
  29407. false
  29408. ],
  29409. "Imlib2": [
  29410. "Imlib2 License",
  29411. false,
  29412. false
  29413. ],
  29414. "Info-ZIP": [
  29415. "Info-ZIP License",
  29416. false,
  29417. false
  29418. ],
  29419. "Intel": [
  29420. "Intel Open Source License",
  29421. true,
  29422. false
  29423. ],
  29424. "Intel-ACPI": [
  29425. "Intel ACPI Software License Agreement",
  29426. false,
  29427. false
  29428. ],
  29429. "Interbase-1.0": [
  29430. "Interbase Public License v1.0",
  29431. false,
  29432. false
  29433. ],
  29434. "IPA": [
  29435. "IPA Font License",
  29436. true,
  29437. false
  29438. ],
  29439. "IPL-1.0": [
  29440. "IBM Public License v1.0",
  29441. true,
  29442. false
  29443. ],
  29444. "ISC": [
  29445. "ISC License",
  29446. true,
  29447. false
  29448. ],
  29449. "JasPer-2.0": [
  29450. "JasPer License",
  29451. false,
  29452. false
  29453. ],
  29454. "JSON": [
  29455. "JSON License",
  29456. false,
  29457. false
  29458. ],
  29459. "LAL-1.2": [
  29460. "Licence Art Libre 1.2",
  29461. false,
  29462. false
  29463. ],
  29464. "LAL-1.3": [
  29465. "Licence Art Libre 1.3",
  29466. false,
  29467. false
  29468. ],
  29469. "Latex2e": [
  29470. "Latex2e License",
  29471. false,
  29472. false
  29473. ],
  29474. "Leptonica": [
  29475. "Leptonica License",
  29476. false,
  29477. false
  29478. ],
  29479. "LGPL-2.0": [
  29480. "GNU Library General Public License v2 only",
  29481. true,
  29482. true
  29483. ],
  29484. "LGPL-2.0+": [
  29485. "GNU Library General Public License v2 or later",
  29486. true,
  29487. true
  29488. ],
  29489. "LGPL-2.0-only": [
  29490. "GNU Library General Public License v2 only",
  29491. true,
  29492. false
  29493. ],
  29494. "LGPL-2.0-or-later": [
  29495. "GNU Library General Public License v2 or later",
  29496. true,
  29497. false
  29498. ],
  29499. "LGPL-2.1": [
  29500. "GNU Lesser General Public License v2.1 only",
  29501. true,
  29502. true
  29503. ],
  29504. "LGPL-2.1+": [
  29505. "GNU Library General Public License v2 or later",
  29506. true,
  29507. true
  29508. ],
  29509. "LGPL-2.1-only": [
  29510. "GNU Lesser General Public License v2.1 only",
  29511. true,
  29512. false
  29513. ],
  29514. "LGPL-2.1-or-later": [
  29515. "GNU Lesser General Public License v2.1 or later",
  29516. true,
  29517. false
  29518. ],
  29519. "LGPL-3.0": [
  29520. "GNU Lesser General Public License v3.0 only",
  29521. true,
  29522. true
  29523. ],
  29524. "LGPL-3.0+": [
  29525. "GNU Lesser General Public License v3.0 or later",
  29526. true,
  29527. true
  29528. ],
  29529. "LGPL-3.0-only": [
  29530. "GNU Lesser General Public License v3.0 only",
  29531. true,
  29532. false
  29533. ],
  29534. "LGPL-3.0-or-later": [
  29535. "GNU Lesser General Public License v3.0 or later",
  29536. true,
  29537. false
  29538. ],
  29539. "LGPLLR": [
  29540. "Lesser General Public License For Linguistic Resources",
  29541. false,
  29542. false
  29543. ],
  29544. "Libpng": [
  29545. "libpng License",
  29546. false,
  29547. false
  29548. ],
  29549. "libtiff": [
  29550. "libtiff License",
  29551. false,
  29552. false
  29553. ],
  29554. "LiLiQ-P-1.1": [
  29555. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  29556. true,
  29557. false
  29558. ],
  29559. "LiLiQ-R-1.1": [
  29560. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  29561. true,
  29562. false
  29563. ],
  29564. "LiLiQ-Rplus-1.1": [
  29565. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  29566. true,
  29567. false
  29568. ],
  29569. "LPL-1.0": [
  29570. "Lucent Public License Version 1.0",
  29571. true,
  29572. false
  29573. ],
  29574. "LPL-1.02": [
  29575. "Lucent Public License v1.02",
  29576. true,
  29577. false
  29578. ],
  29579. "LPPL-1.0": [
  29580. "LaTeX Project Public License v1.0",
  29581. false,
  29582. false
  29583. ],
  29584. "LPPL-1.1": [
  29585. "LaTeX Project Public License v1.1",
  29586. false,
  29587. false
  29588. ],
  29589. "LPPL-1.2": [
  29590. "LaTeX Project Public License v1.2",
  29591. false,
  29592. false
  29593. ],
  29594. "LPPL-1.3a": [
  29595. "LaTeX Project Public License v1.3a",
  29596. false,
  29597. false
  29598. ],
  29599. "LPPL-1.3c": [
  29600. "LaTeX Project Public License v1.3c",
  29601. true,
  29602. false
  29603. ],
  29604. "MakeIndex": [
  29605. "MakeIndex License",
  29606. false,
  29607. false
  29608. ],
  29609. "MirOS": [
  29610. "MirOS License",
  29611. true,
  29612. false
  29613. ],
  29614. "MIT": [
  29615. "MIT License",
  29616. true,
  29617. false
  29618. ],
  29619. "MIT-advertising": [
  29620. "Enlightenment License (e16)",
  29621. false,
  29622. false
  29623. ],
  29624. "MIT-CMU": [
  29625. "CMU License",
  29626. false,
  29627. false
  29628. ],
  29629. "MIT-enna": [
  29630. "enna License",
  29631. false,
  29632. false
  29633. ],
  29634. "MIT-feh": [
  29635. "feh License",
  29636. false,
  29637. false
  29638. ],
  29639. "MITNFA": [
  29640. "MIT +no-false-attribs license",
  29641. false,
  29642. false
  29643. ],
  29644. "Motosoto": [
  29645. "Motosoto License",
  29646. true,
  29647. false
  29648. ],
  29649. "mpich2": [
  29650. "mpich2 License",
  29651. false,
  29652. false
  29653. ],
  29654. "MPL-1.0": [
  29655. "Mozilla Public License 1.0",
  29656. true,
  29657. false
  29658. ],
  29659. "MPL-1.1": [
  29660. "Mozilla Public License 1.1",
  29661. true,
  29662. false
  29663. ],
  29664. "MPL-2.0": [
  29665. "Mozilla Public License 2.0",
  29666. true,
  29667. false
  29668. ],
  29669. "MPL-2.0-no-copyleft-exception": [
  29670. "Mozilla Public License 2.0 (no copyleft exception)",
  29671. true,
  29672. false
  29673. ],
  29674. "MS-PL": [
  29675. "Microsoft Public License",
  29676. true,
  29677. false
  29678. ],
  29679. "MS-RL": [
  29680. "Microsoft Reciprocal License",
  29681. true,
  29682. false
  29683. ],
  29684. "MTLL": [
  29685. "Matrix Template Library License",
  29686. false,
  29687. false
  29688. ],
  29689. "Multics": [
  29690. "Multics License",
  29691. true,
  29692. false
  29693. ],
  29694. "Mup": [
  29695. "Mup License",
  29696. false,
  29697. false
  29698. ],
  29699. "NASA-1.3": [
  29700. "NASA Open Source Agreement 1.3",
  29701. true,
  29702. false
  29703. ],
  29704. "Naumen": [
  29705. "Naumen Public License",
  29706. true,
  29707. false
  29708. ],
  29709. "NBPL-1.0": [
  29710. "Net Boolean Public License v1",
  29711. false,
  29712. false
  29713. ],
  29714. "NCSA": [
  29715. "University of Illinois/NCSA Open Source License",
  29716. true,
  29717. false
  29718. ],
  29719. "Net-SNMP": [
  29720. "Net-SNMP License",
  29721. false,
  29722. false
  29723. ],
  29724. "NetCDF": [
  29725. "NetCDF license",
  29726. false,
  29727. false
  29728. ],
  29729. "Newsletr": [
  29730. "Newsletr License",
  29731. false,
  29732. false
  29733. ],
  29734. "NGPL": [
  29735. "Nethack General Public License",
  29736. true,
  29737. false
  29738. ],
  29739. "NLOD-1.0": [
  29740. "Norwegian Licence for Open Government Data",
  29741. false,
  29742. false
  29743. ],
  29744. "NLPL": [
  29745. "No Limit Public License",
  29746. false,
  29747. false
  29748. ],
  29749. "Nokia": [
  29750. "Nokia Open Source License",
  29751. true,
  29752. false
  29753. ],
  29754. "NOSL": [
  29755. "Netizen Open Source License",
  29756. false,
  29757. false
  29758. ],
  29759. "Noweb": [
  29760. "Noweb License",
  29761. false,
  29762. false
  29763. ],
  29764. "NPL-1.0": [
  29765. "Netscape Public License v1.0",
  29766. false,
  29767. false
  29768. ],
  29769. "NPL-1.1": [
  29770. "Netscape Public License v1.1",
  29771. false,
  29772. false
  29773. ],
  29774. "NPOSL-3.0": [
  29775. "Non-Profit Open Software License 3.0",
  29776. true,
  29777. false
  29778. ],
  29779. "NRL": [
  29780. "NRL License",
  29781. false,
  29782. false
  29783. ],
  29784. "NTP": [
  29785. "NTP License",
  29786. true,
  29787. false
  29788. ],
  29789. "Nunit": [
  29790. "Nunit License",
  29791. false,
  29792. true
  29793. ],
  29794. "OCCT-PL": [
  29795. "Open CASCADE Technology Public License",
  29796. false,
  29797. false
  29798. ],
  29799. "OCLC-2.0": [
  29800. "OCLC Research Public License 2.0",
  29801. true,
  29802. false
  29803. ],
  29804. "ODbL-1.0": [
  29805. "ODC Open Database License v1.0",
  29806. false,
  29807. false
  29808. ],
  29809. "OFL-1.0": [
  29810. "SIL Open Font License 1.0",
  29811. false,
  29812. false
  29813. ],
  29814. "OFL-1.1": [
  29815. "SIL Open Font License 1.1",
  29816. true,
  29817. false
  29818. ],
  29819. "OGTSL": [
  29820. "Open Group Test Suite License",
  29821. true,
  29822. false
  29823. ],
  29824. "OLDAP-1.1": [
  29825. "Open LDAP Public License v1.1",
  29826. false,
  29827. false
  29828. ],
  29829. "OLDAP-1.2": [
  29830. "Open LDAP Public License v1.2",
  29831. false,
  29832. false
  29833. ],
  29834. "OLDAP-1.3": [
  29835. "Open LDAP Public License v1.3",
  29836. false,
  29837. false
  29838. ],
  29839. "OLDAP-1.4": [
  29840. "Open LDAP Public License v1.4",
  29841. false,
  29842. false
  29843. ],
  29844. "OLDAP-2.0": [
  29845. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  29846. false,
  29847. false
  29848. ],
  29849. "OLDAP-2.0.1": [
  29850. "Open LDAP Public License v2.0.1",
  29851. false,
  29852. false
  29853. ],
  29854. "OLDAP-2.1": [
  29855. "Open LDAP Public License v2.1",
  29856. false,
  29857. false
  29858. ],
  29859. "OLDAP-2.2": [
  29860. "Open LDAP Public License v2.2",
  29861. false,
  29862. false
  29863. ],
  29864. "OLDAP-2.2.1": [
  29865. "Open LDAP Public License v2.2.1",
  29866. false,
  29867. false
  29868. ],
  29869. "OLDAP-2.2.2": [
  29870. "Open LDAP Public License 2.2.2",
  29871. false,
  29872. false
  29873. ],
  29874. "OLDAP-2.3": [
  29875. "Open LDAP Public License v2.3",
  29876. false,
  29877. false
  29878. ],
  29879. "OLDAP-2.4": [
  29880. "Open LDAP Public License v2.4",
  29881. false,
  29882. false
  29883. ],
  29884. "OLDAP-2.5": [
  29885. "Open LDAP Public License v2.5",
  29886. false,
  29887. false
  29888. ],
  29889. "OLDAP-2.6": [
  29890. "Open LDAP Public License v2.6",
  29891. false,
  29892. false
  29893. ],
  29894. "OLDAP-2.7": [
  29895. "Open LDAP Public License v2.7",
  29896. false,
  29897. false
  29898. ],
  29899. "OLDAP-2.8": [
  29900. "Open LDAP Public License v2.8",
  29901. false,
  29902. false
  29903. ],
  29904. "OML": [
  29905. "Open Market License",
  29906. false,
  29907. false
  29908. ],
  29909. "OpenSSL": [
  29910. "OpenSSL License",
  29911. false,
  29912. false
  29913. ],
  29914. "OPL-1.0": [
  29915. "Open Public License v1.0",
  29916. false,
  29917. false
  29918. ],
  29919. "OSET-PL-2.1": [
  29920. "OSET Public License version 2.1",
  29921. true,
  29922. false
  29923. ],
  29924. "OSL-1.0": [
  29925. "Open Software License 1.0",
  29926. true,
  29927. false
  29928. ],
  29929. "OSL-1.1": [
  29930. "Open Software License 1.1",
  29931. false,
  29932. false
  29933. ],
  29934. "OSL-2.0": [
  29935. "Open Software License 2.0",
  29936. true,
  29937. false
  29938. ],
  29939. "OSL-2.1": [
  29940. "Open Software License 2.1",
  29941. true,
  29942. false
  29943. ],
  29944. "OSL-3.0": [
  29945. "Open Software License 3.0",
  29946. true,
  29947. false
  29948. ],
  29949. "PDDL-1.0": [
  29950. "ODC Public Domain Dedication & License 1.0",
  29951. false,
  29952. false
  29953. ],
  29954. "PHP-3.0": [
  29955. "PHP License v3.0",
  29956. true,
  29957. false
  29958. ],
  29959. "PHP-3.01": [
  29960. "PHP License v3.01",
  29961. false,
  29962. false
  29963. ],
  29964. "Plexus": [
  29965. "Plexus Classworlds License",
  29966. false,
  29967. false
  29968. ],
  29969. "PostgreSQL": [
  29970. "PostgreSQL License",
  29971. true,
  29972. false
  29973. ],
  29974. "psfrag": [
  29975. "psfrag License",
  29976. false,
  29977. false
  29978. ],
  29979. "psutils": [
  29980. "psutils License",
  29981. false,
  29982. false
  29983. ],
  29984. "Python-2.0": [
  29985. "Python License 2.0",
  29986. true,
  29987. false
  29988. ],
  29989. "Qhull": [
  29990. "Qhull License",
  29991. false,
  29992. false
  29993. ],
  29994. "QPL-1.0": [
  29995. "Q Public License 1.0",
  29996. true,
  29997. false
  29998. ],
  29999. "Rdisc": [
  30000. "Rdisc License",
  30001. false,
  30002. false
  30003. ],
  30004. "RHeCos-1.1": [
  30005. "Red Hat eCos Public License v1.1",
  30006. false,
  30007. false
  30008. ],
  30009. "RPL-1.1": [
  30010. "Reciprocal Public License 1.1",
  30011. true,
  30012. false
  30013. ],
  30014. "RPL-1.5": [
  30015. "Reciprocal Public License 1.5",
  30016. true,
  30017. false
  30018. ],
  30019. "RPSL-1.0": [
  30020. "RealNetworks Public Source License v1.0",
  30021. true,
  30022. false
  30023. ],
  30024. "RSA-MD": [
  30025. "RSA Message-Digest License",
  30026. false,
  30027. false
  30028. ],
  30029. "RSCPL": [
  30030. "Ricoh Source Code Public License",
  30031. true,
  30032. false
  30033. ],
  30034. "Ruby": [
  30035. "Ruby License",
  30036. false,
  30037. false
  30038. ],
  30039. "SAX-PD": [
  30040. "Sax Public Domain Notice",
  30041. false,
  30042. false
  30043. ],
  30044. "Saxpath": [
  30045. "Saxpath License",
  30046. false,
  30047. false
  30048. ],
  30049. "SCEA": [
  30050. "SCEA Shared Source License",
  30051. false,
  30052. false
  30053. ],
  30054. "Sendmail": [
  30055. "Sendmail License",
  30056. false,
  30057. false
  30058. ],
  30059. "SGI-B-1.0": [
  30060. "SGI Free Software License B v1.0",
  30061. false,
  30062. false
  30063. ],
  30064. "SGI-B-1.1": [
  30065. "SGI Free Software License B v1.1",
  30066. false,
  30067. false
  30068. ],
  30069. "SGI-B-2.0": [
  30070. "SGI Free Software License B v2.0",
  30071. false,
  30072. false
  30073. ],
  30074. "SimPL-2.0": [
  30075. "Simple Public License 2.0",
  30076. true,
  30077. false
  30078. ],
  30079. "SISSL": [
  30080. "Sun Industry Standards Source License v1.1",
  30081. true,
  30082. false
  30083. ],
  30084. "SISSL-1.2": [
  30085. "Sun Industry Standards Source License v1.2",
  30086. false,
  30087. false
  30088. ],
  30089. "Sleepycat": [
  30090. "Sleepycat License",
  30091. true,
  30092. false
  30093. ],
  30094. "SMLNJ": [
  30095. "Standard ML of New Jersey License",
  30096. false,
  30097. false
  30098. ],
  30099. "SMPPL": [
  30100. "Secure Messaging Protocol Public License",
  30101. false,
  30102. false
  30103. ],
  30104. "SNIA": [
  30105. "SNIA Public License 1.1",
  30106. false,
  30107. false
  30108. ],
  30109. "Spencer-86": [
  30110. "Spencer License 86",
  30111. false,
  30112. false
  30113. ],
  30114. "Spencer-94": [
  30115. "Spencer License 94",
  30116. false,
  30117. false
  30118. ],
  30119. "Spencer-99": [
  30120. "Spencer License 99",
  30121. false,
  30122. false
  30123. ],
  30124. "SPL-1.0": [
  30125. "Sun Public License v1.0",
  30126. true,
  30127. false
  30128. ],
  30129. "StandardML-NJ": [
  30130. "Standard ML of New Jersey License",
  30131. false,
  30132. true
  30133. ],
  30134. "SugarCRM-1.1.3": [
  30135. "SugarCRM Public License v1.1.3",
  30136. false,
  30137. false
  30138. ],
  30139. "SWL": [
  30140. "Scheme Widget Library (SWL) Software License Agreement",
  30141. false,
  30142. false
  30143. ],
  30144. "TCL": [
  30145. "TCL/TK License",
  30146. false,
  30147. false
  30148. ],
  30149. "TCP-wrappers": [
  30150. "TCP Wrappers License",
  30151. false,
  30152. false
  30153. ],
  30154. "TMate": [
  30155. "TMate Open Source License",
  30156. false,
  30157. false
  30158. ],
  30159. "TORQUE-1.1": [
  30160. "TORQUE v2.5+ Software License v1.1",
  30161. false,
  30162. false
  30163. ],
  30164. "TOSL": [
  30165. "Trusster Open Source License",
  30166. false,
  30167. false
  30168. ],
  30169. "Unicode-DFS-2015": [
  30170. "Unicode License Agreement - Data Files and Software (2015)",
  30171. false,
  30172. false
  30173. ],
  30174. "Unicode-DFS-2016": [
  30175. "Unicode License Agreement - Data Files and Software (2016)",
  30176. false,
  30177. false
  30178. ],
  30179. "Unicode-TOU": [
  30180. "Unicode Terms of Use",
  30181. false,
  30182. false
  30183. ],
  30184. "Unlicense": [
  30185. "The Unlicense",
  30186. false,
  30187. false
  30188. ],
  30189. "UPL-1.0": [
  30190. "Universal Permissive License v1.0",
  30191. true,
  30192. false
  30193. ],
  30194. "Vim": [
  30195. "Vim License",
  30196. false,
  30197. false
  30198. ],
  30199. "VOSTROM": [
  30200. "VOSTROM Public License for Open Source",
  30201. false,
  30202. false
  30203. ],
  30204. "VSL-1.0": [
  30205. "Vovida Software License v1.0",
  30206. true,
  30207. false
  30208. ],
  30209. "W3C": [
  30210. "W3C Software Notice and License (2002-12-31)",
  30211. true,
  30212. false
  30213. ],
  30214. "W3C-19980720": [
  30215. "W3C Software Notice and License (1998-07-20)",
  30216. false,
  30217. false
  30218. ],
  30219. "W3C-20150513": [
  30220. "W3C Software Notice and Document License (2015-05-13)",
  30221. false,
  30222. false
  30223. ],
  30224. "Watcom-1.0": [
  30225. "Sybase Open Watcom Public License 1.0",
  30226. true,
  30227. false
  30228. ],
  30229. "Wsuipa": [
  30230. "Wsuipa License",
  30231. false,
  30232. false
  30233. ],
  30234. "WTFPL": [
  30235. "Do What The F*ck You Want To Public License",
  30236. false,
  30237. false
  30238. ],
  30239. "wxWindows": [
  30240. "wxWindows Library License",
  30241. false,
  30242. true
  30243. ],
  30244. "X11": [
  30245. "X11 License",
  30246. false,
  30247. false
  30248. ],
  30249. "Xerox": [
  30250. "Xerox License",
  30251. false,
  30252. false
  30253. ],
  30254. "XFree86-1.1": [
  30255. "XFree86 License 1.1",
  30256. false,
  30257. false
  30258. ],
  30259. "xinetd": [
  30260. "xinetd License",
  30261. false,
  30262. false
  30263. ],
  30264. "Xnet": [
  30265. "X.Net License",
  30266. true,
  30267. false
  30268. ],
  30269. "xpp": [
  30270. "XPP License",
  30271. false,
  30272. false
  30273. ],
  30274. "XSkat": [
  30275. "XSkat License",
  30276. false,
  30277. false
  30278. ],
  30279. "YPL-1.0": [
  30280. "Yahoo! Public License v1.0",
  30281. false,
  30282. false
  30283. ],
  30284. "YPL-1.1": [
  30285. "Yahoo! Public License v1.1",
  30286. false,
  30287. false
  30288. ],
  30289. "Zed": [
  30290. "Zed License",
  30291. false,
  30292. false
  30293. ],
  30294. "Zend-2.0": [
  30295. "Zend License v2.0",
  30296. false,
  30297. false
  30298. ],
  30299. "Zimbra-1.3": [
  30300. "Zimbra Public License v1.3",
  30301. false,
  30302. false
  30303. ],
  30304. "Zimbra-1.4": [
  30305. "Zimbra Public License v1.4",
  30306. false,
  30307. false
  30308. ],
  30309. "Zlib": [
  30310. "zlib License",
  30311. true,
  30312. false
  30313. ],
  30314. "zlib-acknowledgement": [
  30315. "zlib/libpng License with Acknowledgement",
  30316. false,
  30317. false
  30318. ],
  30319. "ZPL-1.1": [
  30320. "Zope Public License 1.1",
  30321. false,
  30322. false
  30323. ],
  30324. "ZPL-2.0": [
  30325. "Zope Public License 2.0",
  30326. true,
  30327. false
  30328. ],
  30329. "ZPL-2.1": [
  30330. "Zope Public License 2.1",
  30331. false,
  30332. false
  30333. ]
  30334. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  30335. $�������Æ,Í;§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��������à�  ��
  30336. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  30337. ����������������� ��`.rdata����� ���
  30338. �����������������@��@.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
  30339. 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
  30340. 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
  30341. 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">
  30342. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  30343. <security>
  30344. <requestedPrivileges>
  30345. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  30346. </requestedPrivileges>
  30347. </security>
  30348. </trustInfo>
  30349. <dependency>
  30350. <dependentAssembly>
  30351. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  30352. </dependentAssembly>
  30353. </dependency>
  30354. </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
  30355. namespace Symfony\Component\Console;
  30356. use Symfony\Component\Console\Descriptor\TextDescriptor;
  30357. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  30358. use Symfony\Component\Console\Exception\ExceptionInterface;
  30359. use Symfony\Component\Console\Formatter\OutputFormatter;
  30360. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  30361. use Symfony\Component\Console\Helper\Helper;
  30362. use Symfony\Component\Console\Helper\ProcessHelper;
  30363. use Symfony\Component\Console\Helper\QuestionHelper;
  30364. use Symfony\Component\Console\Input\InputInterface;
  30365. use Symfony\Component\Console\Input\ArgvInput;
  30366. use Symfony\Component\Console\Input\ArrayInput;
  30367. use Symfony\Component\Console\Input\InputDefinition;
  30368. use Symfony\Component\Console\Input\InputOption;
  30369. use Symfony\Component\Console\Input\InputArgument;
  30370. use Symfony\Component\Console\Input\InputAwareInterface;
  30371. use Symfony\Component\Console\Output\BufferedOutput;
  30372. use Symfony\Component\Console\Output\OutputInterface;
  30373. use Symfony\Component\Console\Output\ConsoleOutput;
  30374. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  30375. use Symfony\Component\Console\Command\Command;
  30376. use Symfony\Component\Console\Command\HelpCommand;
  30377. use Symfony\Component\Console\Command\ListCommand;
  30378. use Symfony\Component\Console\Helper\HelperSet;
  30379. use Symfony\Component\Console\Helper\FormatterHelper;
  30380. use Symfony\Component\Console\Helper\DialogHelper;
  30381. use Symfony\Component\Console\Helper\ProgressHelper;
  30382. use Symfony\Component\Console\Helper\TableHelper;
  30383. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  30384. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  30385. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  30386. use Symfony\Component\Console\Exception\CommandNotFoundException;
  30387. use Symfony\Component\Console\Exception\LogicException;
  30388. use Symfony\Component\Debug\Exception\FatalThrowableError;
  30389. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  30390. class Application
  30391. {
  30392. private $commands = array();
  30393. private $wantHelps = false;
  30394. private $runningCommand;
  30395. private $name;
  30396. private $version;
  30397. private $catchExceptions = true;
  30398. private $autoExit = true;
  30399. private $definition;
  30400. private $helperSet;
  30401. private $dispatcher;
  30402. private $terminalDimensions;
  30403. private $defaultCommand;
  30404. private $initialized;
  30405. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  30406. {
  30407. $this->name = $name;
  30408. $this->version = $version;
  30409. $this->defaultCommand = 'list';
  30410. }
  30411. public function setDispatcher(EventDispatcherInterface $dispatcher)
  30412. {
  30413. $this->dispatcher = $dispatcher;
  30414. }
  30415. public function run(InputInterface $input = null, OutputInterface $output = null)
  30416. {
  30417. if (null === $input) {
  30418. $input = new ArgvInput();
  30419. }
  30420. if (null === $output) {
  30421. $output = new ConsoleOutput();
  30422. }
  30423. $this->configureIO($input, $output);
  30424. try {
  30425. $e = null;
  30426. $exitCode = $this->doRun($input, $output);
  30427. } catch (\Exception $e) {
  30428. }
  30429. if (null !== $e) {
  30430. if (!$this->catchExceptions) {
  30431. throw $e;
  30432. }
  30433. if ($output instanceof ConsoleOutputInterface) {
  30434. $this->renderException($e, $output->getErrorOutput());
  30435. } else {
  30436. $this->renderException($e, $output);
  30437. }
  30438. $exitCode = $e->getCode();
  30439. if (is_numeric($exitCode)) {
  30440. $exitCode = (int) $exitCode;
  30441. if (0 === $exitCode) {
  30442. $exitCode = 1;
  30443. }
  30444. } else {
  30445. $exitCode = 1;
  30446. }
  30447. }
  30448. if ($this->autoExit) {
  30449. if ($exitCode > 255) {
  30450. $exitCode = 255;
  30451. }
  30452. exit($exitCode);
  30453. }
  30454. return $exitCode;
  30455. }
  30456. public function doRun(InputInterface $input, OutputInterface $output)
  30457. {
  30458. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  30459. $output->writeln($this->getLongVersion());
  30460. return 0;
  30461. }
  30462. $name = $this->getCommandName($input);
  30463. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  30464. if (!$name) {
  30465. $name = 'help';
  30466. $input = new ArrayInput(array('command' => 'help'));
  30467. } else {
  30468. $this->wantHelps = true;
  30469. }
  30470. }
  30471. if (!$name) {
  30472. $name = $this->defaultCommand;
  30473. $definition = $this->getDefinition();
  30474. $definition->setArguments(array_merge(
  30475. $definition->getArguments(),
  30476. array(
  30477. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  30478. )
  30479. ));
  30480. }
  30481. $this->runningCommand = null;
  30482. $command = $this->find($name);
  30483. $this->runningCommand = $command;
  30484. $exitCode = $this->doRunCommand($command, $input, $output);
  30485. $this->runningCommand = null;
  30486. return $exitCode;
  30487. }
  30488. public function setHelperSet(HelperSet $helperSet)
  30489. {
  30490. $this->helperSet = $helperSet;
  30491. }
  30492. public function getHelperSet()
  30493. {
  30494. if (!$this->helperSet) {
  30495. $this->helperSet = $this->getDefaultHelperSet();
  30496. }
  30497. return $this->helperSet;
  30498. }
  30499. public function setDefinition(InputDefinition $definition)
  30500. {
  30501. $this->definition = $definition;
  30502. }
  30503. public function getDefinition()
  30504. {
  30505. if (!$this->definition) {
  30506. $this->definition = $this->getDefaultInputDefinition();
  30507. }
  30508. return $this->definition;
  30509. }
  30510. public function getHelp()
  30511. {
  30512. return $this->getLongVersion();
  30513. }
  30514. public function setCatchExceptions($boolean)
  30515. {
  30516. $this->catchExceptions = (bool) $boolean;
  30517. }
  30518. public function setAutoExit($boolean)
  30519. {
  30520. $this->autoExit = (bool) $boolean;
  30521. }
  30522. public function getName()
  30523. {
  30524. return $this->name;
  30525. }
  30526. public function setName($name)
  30527. {
  30528. $this->name = $name;
  30529. }
  30530. public function getVersion()
  30531. {
  30532. return $this->version;
  30533. }
  30534. public function setVersion($version)
  30535. {
  30536. $this->version = $version;
  30537. }
  30538. public function getLongVersion()
  30539. {
  30540. if ('UNKNOWN' !== $this->getName()) {
  30541. if ('UNKNOWN' !== $this->getVersion()) {
  30542. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  30543. }
  30544. return sprintf('<info>%s</info>', $this->getName());
  30545. }
  30546. return '<info>Console Tool</info>';
  30547. }
  30548. public function register($name)
  30549. {
  30550. return $this->add(new Command($name));
  30551. }
  30552. public function addCommands(array $commands)
  30553. {
  30554. foreach ($commands as $command) {
  30555. $this->add($command);
  30556. }
  30557. }
  30558. public function add(Command $command)
  30559. {
  30560. $this->init();
  30561. $command->setApplication($this);
  30562. if (!$command->isEnabled()) {
  30563. $command->setApplication(null);
  30564. return;
  30565. }
  30566. if (null === $command->getDefinition()) {
  30567. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
  30568. }
  30569. $this->commands[$command->getName()] = $command;
  30570. foreach ($command->getAliases() as $alias) {
  30571. $this->commands[$alias] = $command;
  30572. }
  30573. return $command;
  30574. }
  30575. public function get($name)
  30576. {
  30577. $this->init();
  30578. if (!isset($this->commands[$name])) {
  30579. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  30580. }
  30581. $command = $this->commands[$name];
  30582. if ($this->wantHelps) {
  30583. $this->wantHelps = false;
  30584. $helpCommand = $this->get('help');
  30585. $helpCommand->setCommand($command);
  30586. return $helpCommand;
  30587. }
  30588. return $command;
  30589. }
  30590. public function has($name)
  30591. {
  30592. $this->init();
  30593. return isset($this->commands[$name]);
  30594. }
  30595. public function getNamespaces()
  30596. {
  30597. $namespaces = array();
  30598. foreach ($this->all() as $command) {
  30599. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  30600. foreach ($command->getAliases() as $alias) {
  30601. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  30602. }
  30603. }
  30604. return array_values(array_unique(array_filter($namespaces)));
  30605. }
  30606. public function findNamespace($namespace)
  30607. {
  30608. $allNamespaces = $this->getNamespaces();
  30609. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  30610. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  30611. if (empty($namespaces)) {
  30612. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  30613. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  30614. if (1 == count($alternatives)) {
  30615. $message .= "\n\nDid you mean this?\n ";
  30616. } else {
  30617. $message .= "\n\nDid you mean one of these?\n ";
  30618. }
  30619. $message .= implode("\n ", $alternatives);
  30620. }
  30621. throw new CommandNotFoundException($message, $alternatives);
  30622. }
  30623. $exact = in_array($namespace, $namespaces, true);
  30624. if (count($namespaces) > 1 && !$exact) {
  30625. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  30626. }
  30627. return $exact ? $namespace : reset($namespaces);
  30628. }
  30629. public function find($name)
  30630. {
  30631. $this->init();
  30632. $allCommands = array_keys($this->commands);
  30633. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  30634. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  30635. if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  30636. if (false !== $pos = strrpos($name, ':')) {
  30637. $this->findNamespace(substr($name, 0, $pos));
  30638. }
  30639. $message = sprintf('Command "%s" is not defined.', $name);
  30640. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  30641. if (1 == count($alternatives)) {
  30642. $message .= "\n\nDid you mean this?\n ";
  30643. } else {
  30644. $message .= "\n\nDid you mean one of these?\n ";
  30645. }
  30646. $message .= implode("\n ", $alternatives);
  30647. }
  30648. throw new CommandNotFoundException($message, $alternatives);
  30649. }
  30650. if (count($commands) > 1) {
  30651. $commandList = $this->commands;
  30652. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) {
  30653. $commandName = $commandList[$nameOrAlias]->getName();
  30654. return $commandName === $nameOrAlias || !in_array($commandName, $commands);
  30655. });
  30656. }
  30657. $exact = in_array($name, $commands, true);
  30658. if (count($commands) > 1 && !$exact) {
  30659. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  30660. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  30661. }
  30662. return $this->get($exact ? $name : reset($commands));
  30663. }
  30664. public function all($namespace = null)
  30665. {
  30666. $this->init();
  30667. if (null === $namespace) {
  30668. return $this->commands;
  30669. }
  30670. $commands = array();
  30671. foreach ($this->commands as $name => $command) {
  30672. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  30673. $commands[$name] = $command;
  30674. }
  30675. }
  30676. return $commands;
  30677. }
  30678. public static function getAbbreviations($names)
  30679. {
  30680. $abbrevs = array();
  30681. foreach ($names as $name) {
  30682. for ($len = strlen($name); $len > 0; --$len) {
  30683. $abbrev = substr($name, 0, $len);
  30684. $abbrevs[$abbrev][] = $name;
  30685. }
  30686. }
  30687. return $abbrevs;
  30688. }
  30689. public function asText($namespace = null, $raw = false)
  30690. {
  30691. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  30692. $descriptor = new TextDescriptor();
  30693. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  30694. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  30695. return $output->fetch();
  30696. }
  30697. public function asXml($namespace = null, $asDom = false)
  30698. {
  30699. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  30700. $descriptor = new XmlDescriptor();
  30701. if ($asDom) {
  30702. return $descriptor->getApplicationDocument($this, $namespace);
  30703. }
  30704. $output = new BufferedOutput();
  30705. $descriptor->describe($output, $this, array('namespace' => $namespace));
  30706. return $output->fetch();
  30707. }
  30708. public function renderException($e, $output)
  30709. {
  30710. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  30711. do {
  30712. $title = sprintf(' [%s] ', get_class($e));
  30713. $len = Helper::strlen($title);
  30714. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  30715. if (defined('HHVM_VERSION') && $width > 1 << 31) {
  30716. $width = 1 << 31;
  30717. }
  30718. $lines = array();
  30719. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  30720. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  30721. $lineLength = Helper::strlen($line) + 4;
  30722. $lines[] = array($line, $lineLength);
  30723. $len = max($lineLength, $len);
  30724. }
  30725. }
  30726. $messages = array();
  30727. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  30728. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  30729. foreach ($lines as $line) {
  30730. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  30731. }
  30732. $messages[] = $emptyLine;
  30733. $messages[] = '';
  30734. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  30735. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  30736. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  30737. $trace = $e->getTrace();
  30738. array_unshift($trace, array(
  30739. 'function' => '',
  30740. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  30741. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  30742. 'args' => array(),
  30743. ));
  30744. for ($i = 0, $count = count($trace); $i < $count; ++$i) {
  30745. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  30746. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  30747. $function = $trace[$i]['function'];
  30748. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  30749. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  30750. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  30751. }
  30752. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  30753. }
  30754. } while ($e = $e->getPrevious());
  30755. if (null !== $this->runningCommand) {
  30756. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  30757. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  30758. }
  30759. }
  30760. protected function getTerminalWidth()
  30761. {
  30762. $dimensions = $this->getTerminalDimensions();
  30763. return $dimensions[0];
  30764. }
  30765. protected function getTerminalHeight()
  30766. {
  30767. $dimensions = $this->getTerminalDimensions();
  30768. return $dimensions[1];
  30769. }
  30770. public function getTerminalDimensions()
  30771. {
  30772. if ($this->terminalDimensions) {
  30773. return $this->terminalDimensions;
  30774. }
  30775. if ('\\' === DIRECTORY_SEPARATOR) {
  30776. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  30777. return array((int) $matches[1], (int) $matches[2]);
  30778. }
  30779. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  30780. return array((int) $matches[1], (int) $matches[2]);
  30781. }
  30782. }
  30783. if ($sttyString = $this->getSttyColumns()) {
  30784. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  30785. return array((int) $matches[2], (int) $matches[1]);
  30786. }
  30787. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  30788. return array((int) $matches[2], (int) $matches[1]);
  30789. }
  30790. }
  30791. return array(null, null);
  30792. }
  30793. public function setTerminalDimensions($width, $height)
  30794. {
  30795. $this->terminalDimensions = array($width, $height);
  30796. return $this;
  30797. }
  30798. protected function configureIO(InputInterface $input, OutputInterface $output)
  30799. {
  30800. if (true === $input->hasParameterOption(array('--ansi'))) {
  30801. $output->setDecorated(true);
  30802. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  30803. $output->setDecorated(false);
  30804. }
  30805. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  30806. $input->setInteractive(false);
  30807. } elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  30808. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  30809. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  30810. $input->setInteractive(false);
  30811. }
  30812. }
  30813. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  30814. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  30815. $input->setInteractive(false);
  30816. } else {
  30817. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  30818. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  30819. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  30820. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  30821. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  30822. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  30823. }
  30824. }
  30825. }
  30826. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  30827. {
  30828. foreach ($command->getHelperSet() as $helper) {
  30829. if ($helper instanceof InputAwareInterface) {
  30830. $helper->setInput($input);
  30831. }
  30832. }
  30833. if (null === $this->dispatcher) {
  30834. return $command->run($input, $output);
  30835. }
  30836. try {
  30837. $command->mergeApplicationDefinition();
  30838. $input->bind($command->getDefinition());
  30839. } catch (ExceptionInterface $e) {
  30840. }
  30841. $event = new ConsoleCommandEvent($command, $input, $output);
  30842. $e = null;
  30843. try {
  30844. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  30845. if ($event->commandShouldRun()) {
  30846. $exitCode = $command->run($input, $output);
  30847. } else {
  30848. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  30849. }
  30850. } catch (\Exception $e) {
  30851. } catch (\Throwable $e) {
  30852. }
  30853. if (null !== $e) {
  30854. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  30855. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  30856. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  30857. if ($x !== $event->getException()) {
  30858. $e = $event->getException();
  30859. }
  30860. $exitCode = $e->getCode();
  30861. }
  30862. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  30863. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  30864. if (null !== $e) {
  30865. throw $e;
  30866. }
  30867. return $event->getExitCode();
  30868. }
  30869. protected function getCommandName(InputInterface $input)
  30870. {
  30871. return $input->getFirstArgument();
  30872. }
  30873. protected function getDefaultInputDefinition()
  30874. {
  30875. return new InputDefinition(array(
  30876. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  30877. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  30878. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  30879. 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'),
  30880. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  30881. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  30882. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  30883. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  30884. ));
  30885. }
  30886. protected function getDefaultCommands()
  30887. {
  30888. return array(new HelpCommand(), new ListCommand());
  30889. }
  30890. protected function getDefaultHelperSet()
  30891. {
  30892. return new HelperSet(array(
  30893. new FormatterHelper(),
  30894. new DialogHelper(false),
  30895. new ProgressHelper(false),
  30896. new TableHelper(false),
  30897. new DebugFormatterHelper(),
  30898. new ProcessHelper(),
  30899. new QuestionHelper(),
  30900. ));
  30901. }
  30902. private function getSttyColumns()
  30903. {
  30904. if (!function_exists('proc_open')) {
  30905. return;
  30906. }
  30907. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  30908. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  30909. if (is_resource($process)) {
  30910. $info = stream_get_contents($pipes[1]);
  30911. fclose($pipes[1]);
  30912. fclose($pipes[2]);
  30913. proc_close($process);
  30914. return $info;
  30915. }
  30916. }
  30917. private function getConsoleMode()
  30918. {
  30919. if (!function_exists('proc_open')) {
  30920. return;
  30921. }
  30922. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  30923. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  30924. if (is_resource($process)) {
  30925. $info = stream_get_contents($pipes[1]);
  30926. fclose($pipes[1]);
  30927. fclose($pipes[2]);
  30928. proc_close($process);
  30929. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  30930. return $matches[2].'x'.$matches[1];
  30931. }
  30932. }
  30933. }
  30934. private function getAbbreviationSuggestions($abbrevs)
  30935. {
  30936. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
  30937. }
  30938. public function extractNamespace($name, $limit = null)
  30939. {
  30940. $parts = explode(':', $name);
  30941. array_pop($parts);
  30942. return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit));
  30943. }
  30944. private function findAlternatives($name, $collection)
  30945. {
  30946. $threshold = 1e3;
  30947. $alternatives = array();
  30948. $collectionParts = array();
  30949. foreach ($collection as $item) {
  30950. $collectionParts[$item] = explode(':', $item);
  30951. }
  30952. foreach (explode(':', $name) as $i => $subname) {
  30953. foreach ($collectionParts as $collectionName => $parts) {
  30954. $exists = isset($alternatives[$collectionName]);
  30955. if (!isset($parts[$i]) && $exists) {
  30956. $alternatives[$collectionName] += $threshold;
  30957. continue;
  30958. } elseif (!isset($parts[$i])) {
  30959. continue;
  30960. }
  30961. $lev = levenshtein($subname, $parts[$i]);
  30962. if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  30963. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  30964. } elseif ($exists) {
  30965. $alternatives[$collectionName] += $threshold;
  30966. }
  30967. }
  30968. }
  30969. foreach ($collection as $item) {
  30970. $lev = levenshtein($name, $item);
  30971. if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
  30972. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  30973. }
  30974. }
  30975. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  30976. asort($alternatives);
  30977. return array_keys($alternatives);
  30978. }
  30979. public function setDefaultCommand($commandName)
  30980. {
  30981. $this->defaultCommand = $commandName;
  30982. }
  30983. private function splitStringByWidth($string, $width)
  30984. {
  30985. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  30986. return str_split($string, $width);
  30987. }
  30988. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  30989. $lines = array();
  30990. $line = '';
  30991. foreach (preg_split('//u', $utf8String) as $char) {
  30992. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  30993. $line .= $char;
  30994. continue;
  30995. }
  30996. $lines[] = str_pad($line, $width);
  30997. $line = $char;
  30998. }
  30999. $lines[] = count($lines) ? str_pad($line, $width) : $line;
  31000. mb_convert_variables($encoding, 'utf8', $lines);
  31001. return $lines;
  31002. }
  31003. private function extractAllNamespaces($name)
  31004. {
  31005. $parts = explode(':', $name, -1);
  31006. $namespaces = array();
  31007. foreach ($parts as $part) {
  31008. if (count($namespaces)) {
  31009. $namespaces[] = end($namespaces).':'.$part;
  31010. } else {
  31011. $namespaces[] = $part;
  31012. }
  31013. }
  31014. return $namespaces;
  31015. }
  31016. private function init()
  31017. {
  31018. if ($this->initialized) {
  31019. return;
  31020. }
  31021. $this->initialized = true;
  31022. foreach ($this->getDefaultCommands() as $command) {
  31023. $this->add($command);
  31024. }
  31025. }
  31026. }
  31027. <?php
  31028. namespace Symfony\Component\Console\Command;
  31029. use Symfony\Component\Console\Descriptor\TextDescriptor;
  31030. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  31031. use Symfony\Component\Console\Exception\ExceptionInterface;
  31032. use Symfony\Component\Console\Input\InputDefinition;
  31033. use Symfony\Component\Console\Input\InputOption;
  31034. use Symfony\Component\Console\Input\InputArgument;
  31035. use Symfony\Component\Console\Input\InputInterface;
  31036. use Symfony\Component\Console\Output\BufferedOutput;
  31037. use Symfony\Component\Console\Output\OutputInterface;
  31038. use Symfony\Component\Console\Application;
  31039. use Symfony\Component\Console\Helper\HelperSet;
  31040. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31041. use Symfony\Component\Console\Exception\LogicException;
  31042. class Command
  31043. {
  31044. private $application;
  31045. private $name;
  31046. private $processTitle;
  31047. private $aliases = array();
  31048. private $definition;
  31049. private $help;
  31050. private $description;
  31051. private $ignoreValidationErrors = false;
  31052. private $applicationDefinitionMerged = false;
  31053. private $applicationDefinitionMergedWithArgs = false;
  31054. private $code;
  31055. private $synopsis = array();
  31056. private $usages = array();
  31057. private $helperSet;
  31058. public function __construct($name = null)
  31059. {
  31060. $this->definition = new InputDefinition();
  31061. if (null !== $name) {
  31062. $this->setName($name);
  31063. }
  31064. $this->configure();
  31065. if (!$this->name) {
  31066. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this)));
  31067. }
  31068. }
  31069. public function ignoreValidationErrors()
  31070. {
  31071. $this->ignoreValidationErrors = true;
  31072. }
  31073. public function setApplication(Application $application = null)
  31074. {
  31075. $this->application = $application;
  31076. if ($application) {
  31077. $this->setHelperSet($application->getHelperSet());
  31078. } else {
  31079. $this->helperSet = null;
  31080. }
  31081. }
  31082. public function setHelperSet(HelperSet $helperSet)
  31083. {
  31084. $this->helperSet = $helperSet;
  31085. }
  31086. public function getHelperSet()
  31087. {
  31088. return $this->helperSet;
  31089. }
  31090. public function getApplication()
  31091. {
  31092. return $this->application;
  31093. }
  31094. public function isEnabled()
  31095. {
  31096. return true;
  31097. }
  31098. protected function configure()
  31099. {
  31100. }
  31101. protected function execute(InputInterface $input, OutputInterface $output)
  31102. {
  31103. throw new LogicException('You must override the execute() method in the concrete command class.');
  31104. }
  31105. protected function interact(InputInterface $input, OutputInterface $output)
  31106. {
  31107. }
  31108. protected function initialize(InputInterface $input, OutputInterface $output)
  31109. {
  31110. }
  31111. public function run(InputInterface $input, OutputInterface $output)
  31112. {
  31113. $this->getSynopsis(true);
  31114. $this->getSynopsis(false);
  31115. $this->mergeApplicationDefinition();
  31116. try {
  31117. $input->bind($this->definition);
  31118. } catch (ExceptionInterface $e) {
  31119. if (!$this->ignoreValidationErrors) {
  31120. throw $e;
  31121. }
  31122. }
  31123. $this->initialize($input, $output);
  31124. if (null !== $this->processTitle) {
  31125. if (function_exists('cli_set_process_title')) {
  31126. if (false === @cli_set_process_title($this->processTitle)) {
  31127. if ('Darwin' === PHP_OS) {
  31128. $output->writeln('<comment>Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.</comment>');
  31129. } else {
  31130. $error = error_get_last();
  31131. trigger_error($error['message'], E_USER_WARNING);
  31132. }
  31133. }
  31134. } elseif (function_exists('setproctitle')) {
  31135. setproctitle($this->processTitle);
  31136. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  31137. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  31138. }
  31139. }
  31140. if ($input->isInteractive()) {
  31141. $this->interact($input, $output);
  31142. }
  31143. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  31144. $input->setArgument('command', $this->getName());
  31145. }
  31146. $input->validate();
  31147. if ($this->code) {
  31148. $statusCode = call_user_func($this->code, $input, $output);
  31149. } else {
  31150. $statusCode = $this->execute($input, $output);
  31151. }
  31152. return is_numeric($statusCode) ? (int) $statusCode : 0;
  31153. }
  31154. public function setCode($code)
  31155. {
  31156. if (!is_callable($code)) {
  31157. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  31158. }
  31159. if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  31160. $r = new \ReflectionFunction($code);
  31161. if (null === $r->getClosureThis()) {
  31162. if (PHP_VERSION_ID < 70000) {
  31163. $code = @\Closure::bind($code, $this);
  31164. } else {
  31165. $code = \Closure::bind($code, $this);
  31166. }
  31167. }
  31168. }
  31169. $this->code = $code;
  31170. return $this;
  31171. }
  31172. public function mergeApplicationDefinition($mergeArgs = true)
  31173. {
  31174. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  31175. return;
  31176. }
  31177. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  31178. if ($mergeArgs) {
  31179. $currentArguments = $this->definition->getArguments();
  31180. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  31181. $this->definition->addArguments($currentArguments);
  31182. }
  31183. $this->applicationDefinitionMerged = true;
  31184. if ($mergeArgs) {
  31185. $this->applicationDefinitionMergedWithArgs = true;
  31186. }
  31187. }
  31188. public function setDefinition($definition)
  31189. {
  31190. if ($definition instanceof InputDefinition) {
  31191. $this->definition = $definition;
  31192. } else {
  31193. $this->definition->setDefinition($definition);
  31194. }
  31195. $this->applicationDefinitionMerged = false;
  31196. return $this;
  31197. }
  31198. public function getDefinition()
  31199. {
  31200. return $this->definition;
  31201. }
  31202. public function getNativeDefinition()
  31203. {
  31204. return $this->getDefinition();
  31205. }
  31206. public function addArgument($name, $mode = null, $description = '', $default = null)
  31207. {
  31208. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  31209. return $this;
  31210. }
  31211. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  31212. {
  31213. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  31214. return $this;
  31215. }
  31216. public function setName($name)
  31217. {
  31218. $this->validateName($name);
  31219. $this->name = $name;
  31220. return $this;
  31221. }
  31222. public function setProcessTitle($title)
  31223. {
  31224. $this->processTitle = $title;
  31225. return $this;
  31226. }
  31227. public function getName()
  31228. {
  31229. return $this->name;
  31230. }
  31231. public function setDescription($description)
  31232. {
  31233. $this->description = $description;
  31234. return $this;
  31235. }
  31236. public function getDescription()
  31237. {
  31238. return $this->description;
  31239. }
  31240. public function setHelp($help)
  31241. {
  31242. $this->help = $help;
  31243. return $this;
  31244. }
  31245. public function getHelp()
  31246. {
  31247. return $this->help;
  31248. }
  31249. public function getProcessedHelp()
  31250. {
  31251. $name = $this->name;
  31252. $placeholders = array(
  31253. '%command.name%',
  31254. '%command.full_name%',
  31255. );
  31256. $replacements = array(
  31257. $name,
  31258. $_SERVER['PHP_SELF'].' '.$name,
  31259. );
  31260. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  31261. }
  31262. public function setAliases($aliases)
  31263. {
  31264. if (!is_array($aliases) && !$aliases instanceof \Traversable) {
  31265. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  31266. }
  31267. foreach ($aliases as $alias) {
  31268. $this->validateName($alias);
  31269. }
  31270. $this->aliases = $aliases;
  31271. return $this;
  31272. }
  31273. public function getAliases()
  31274. {
  31275. return $this->aliases;
  31276. }
  31277. public function getSynopsis($short = false)
  31278. {
  31279. $key = $short ? 'short' : 'long';
  31280. if (!isset($this->synopsis[$key])) {
  31281. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  31282. }
  31283. return $this->synopsis[$key];
  31284. }
  31285. public function addUsage($usage)
  31286. {
  31287. if (0 !== strpos($usage, $this->name)) {
  31288. $usage = sprintf('%s %s', $this->name, $usage);
  31289. }
  31290. $this->usages[] = $usage;
  31291. return $this;
  31292. }
  31293. public function getUsages()
  31294. {
  31295. return $this->usages;
  31296. }
  31297. public function getHelper($name)
  31298. {
  31299. if (null === $this->helperSet) {
  31300. 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));
  31301. }
  31302. return $this->helperSet->get($name);
  31303. }
  31304. public function asText()
  31305. {
  31306. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31307. $descriptor = new TextDescriptor();
  31308. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  31309. $descriptor->describe($output, $this, array('raw_output' => true));
  31310. return $output->fetch();
  31311. }
  31312. public function asXml($asDom = false)
  31313. {
  31314. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31315. $descriptor = new XmlDescriptor();
  31316. if ($asDom) {
  31317. return $descriptor->getCommandDocument($this);
  31318. }
  31319. $output = new BufferedOutput();
  31320. $descriptor->describe($output, $this);
  31321. return $output->fetch();
  31322. }
  31323. private function validateName($name)
  31324. {
  31325. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  31326. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  31327. }
  31328. }
  31329. }
  31330. <?php
  31331. namespace Symfony\Component\Console\Command;
  31332. use Symfony\Component\Console\Helper\DescriptorHelper;
  31333. use Symfony\Component\Console\Input\InputArgument;
  31334. use Symfony\Component\Console\Input\InputOption;
  31335. use Symfony\Component\Console\Input\InputInterface;
  31336. use Symfony\Component\Console\Output\OutputInterface;
  31337. class HelpCommand extends Command
  31338. {
  31339. private $command;
  31340. protected function configure()
  31341. {
  31342. $this->ignoreValidationErrors();
  31343. $this
  31344. ->setName('help')
  31345. ->setDefinition(array(
  31346. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  31347. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  31348. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  31349. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  31350. ))
  31351. ->setDescription('Displays help for a command')
  31352. ->setHelp(<<<'EOF'
  31353. The <info>%command.name%</info> command displays help for a given command:
  31354. <info>php %command.full_name% list</info>
  31355. You can also output the help in other formats by using the <comment>--format</comment> option:
  31356. <info>php %command.full_name% --format=xml list</info>
  31357. To display the list of available commands, please use the <info>list</info> command.
  31358. EOF
  31359. )
  31360. ;
  31361. }
  31362. public function setCommand(Command $command)
  31363. {
  31364. $this->command = $command;
  31365. }
  31366. protected function execute(InputInterface $input, OutputInterface $output)
  31367. {
  31368. if (null === $this->command) {
  31369. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  31370. }
  31371. if ($input->getOption('xml')) {
  31372. @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);
  31373. $input->setOption('format', 'xml');
  31374. }
  31375. $helper = new DescriptorHelper();
  31376. $helper->describe($output, $this->command, array(
  31377. 'format' => $input->getOption('format'),
  31378. 'raw_text' => $input->getOption('raw'),
  31379. ));
  31380. $this->command = null;
  31381. }
  31382. }
  31383. <?php
  31384. namespace Symfony\Component\Console\Command;
  31385. use Symfony\Component\Console\Helper\DescriptorHelper;
  31386. use Symfony\Component\Console\Input\InputArgument;
  31387. use Symfony\Component\Console\Input\InputOption;
  31388. use Symfony\Component\Console\Input\InputInterface;
  31389. use Symfony\Component\Console\Output\OutputInterface;
  31390. use Symfony\Component\Console\Input\InputDefinition;
  31391. class ListCommand extends Command
  31392. {
  31393. protected function configure()
  31394. {
  31395. $this
  31396. ->setName('list')
  31397. ->setDefinition($this->createDefinition())
  31398. ->setDescription('Lists commands')
  31399. ->setHelp(<<<'EOF'
  31400. The <info>%command.name%</info> command lists all commands:
  31401. <info>php %command.full_name%</info>
  31402. You can also display the commands for a specific namespace:
  31403. <info>php %command.full_name% test</info>
  31404. You can also output the information in other formats by using the <comment>--format</comment> option:
  31405. <info>php %command.full_name% --format=xml</info>
  31406. It's also possible to get raw list of commands (useful for embedding command runner):
  31407. <info>php %command.full_name% --raw</info>
  31408. EOF
  31409. )
  31410. ;
  31411. }
  31412. public function getNativeDefinition()
  31413. {
  31414. return $this->createDefinition();
  31415. }
  31416. protected function execute(InputInterface $input, OutputInterface $output)
  31417. {
  31418. if ($input->getOption('xml')) {
  31419. @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);
  31420. $input->setOption('format', 'xml');
  31421. }
  31422. $helper = new DescriptorHelper();
  31423. $helper->describe($output, $this->getApplication(), array(
  31424. 'format' => $input->getOption('format'),
  31425. 'raw_text' => $input->getOption('raw'),
  31426. 'namespace' => $input->getArgument('namespace'),
  31427. ));
  31428. }
  31429. private function createDefinition()
  31430. {
  31431. return new InputDefinition(array(
  31432. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  31433. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  31434. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  31435. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  31436. ));
  31437. }
  31438. }
  31439. <?php
  31440. namespace Symfony\Component\Console;
  31441. final class ConsoleEvents
  31442. {
  31443. const COMMAND = 'console.command';
  31444. const TERMINATE = 'console.terminate';
  31445. const EXCEPTION = 'console.exception';
  31446. }
  31447. <?php
  31448. namespace Symfony\Component\Console\Descriptor;
  31449. use Symfony\Component\Console\Application;
  31450. use Symfony\Component\Console\Command\Command;
  31451. use Symfony\Component\Console\Exception\CommandNotFoundException;
  31452. class ApplicationDescription
  31453. {
  31454. const GLOBAL_NAMESPACE = '_global';
  31455. private $application;
  31456. private $namespace;
  31457. private $namespaces;
  31458. private $commands;
  31459. private $aliases;
  31460. public function __construct(Application $application, $namespace = null)
  31461. {
  31462. $this->application = $application;
  31463. $this->namespace = $namespace;
  31464. }
  31465. public function getNamespaces()
  31466. {
  31467. if (null === $this->namespaces) {
  31468. $this->inspectApplication();
  31469. }
  31470. return $this->namespaces;
  31471. }
  31472. public function getCommands()
  31473. {
  31474. if (null === $this->commands) {
  31475. $this->inspectApplication();
  31476. }
  31477. return $this->commands;
  31478. }
  31479. public function getCommand($name)
  31480. {
  31481. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  31482. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  31483. }
  31484. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  31485. }
  31486. private function inspectApplication()
  31487. {
  31488. $this->commands = array();
  31489. $this->namespaces = array();
  31490. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  31491. foreach ($this->sortCommands($all) as $namespace => $commands) {
  31492. $names = array();
  31493. foreach ($commands as $name => $command) {
  31494. if (!$command->getName()) {
  31495. continue;
  31496. }
  31497. if ($command->getName() === $name) {
  31498. $this->commands[$name] = $command;
  31499. } else {
  31500. $this->aliases[$name] = $command;
  31501. }
  31502. $names[] = $name;
  31503. }
  31504. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  31505. }
  31506. }
  31507. private function sortCommands(array $commands)
  31508. {
  31509. $namespacedCommands = array();
  31510. $globalCommands = array();
  31511. foreach ($commands as $name => $command) {
  31512. $key = $this->application->extractNamespace($name, 1);
  31513. if (!$key) {
  31514. $globalCommands['_global'][$name] = $command;
  31515. } else {
  31516. $namespacedCommands[$key][$name] = $command;
  31517. }
  31518. }
  31519. ksort($namespacedCommands);
  31520. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  31521. foreach ($namespacedCommands as &$commandsSet) {
  31522. ksort($commandsSet);
  31523. }
  31524. unset($commandsSet);
  31525. return $namespacedCommands;
  31526. }
  31527. }
  31528. <?php
  31529. namespace Symfony\Component\Console\Descriptor;
  31530. use Symfony\Component\Console\Application;
  31531. use Symfony\Component\Console\Command\Command;
  31532. use Symfony\Component\Console\Input\InputArgument;
  31533. use Symfony\Component\Console\Input\InputDefinition;
  31534. use Symfony\Component\Console\Input\InputOption;
  31535. use Symfony\Component\Console\Output\OutputInterface;
  31536. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31537. abstract class Descriptor implements DescriptorInterface
  31538. {
  31539. private $output;
  31540. public function describe(OutputInterface $output, $object, array $options = array())
  31541. {
  31542. $this->output = $output;
  31543. switch (true) {
  31544. case $object instanceof InputArgument:
  31545. $this->describeInputArgument($object, $options);
  31546. break;
  31547. case $object instanceof InputOption:
  31548. $this->describeInputOption($object, $options);
  31549. break;
  31550. case $object instanceof InputDefinition:
  31551. $this->describeInputDefinition($object, $options);
  31552. break;
  31553. case $object instanceof Command:
  31554. $this->describeCommand($object, $options);
  31555. break;
  31556. case $object instanceof Application:
  31557. $this->describeApplication($object, $options);
  31558. break;
  31559. default:
  31560. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object)));
  31561. }
  31562. }
  31563. protected function write($content, $decorated = false)
  31564. {
  31565. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  31566. }
  31567. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  31568. abstract protected function describeInputOption(InputOption $option, array $options = array());
  31569. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  31570. abstract protected function describeCommand(Command $command, array $options = array());
  31571. abstract protected function describeApplication(Application $application, array $options = array());
  31572. }
  31573. <?php
  31574. namespace Symfony\Component\Console\Descriptor;
  31575. use Symfony\Component\Console\Output\OutputInterface;
  31576. interface DescriptorInterface
  31577. {
  31578. public function describe(OutputInterface $output, $object, array $options = array());
  31579. }
  31580. <?php
  31581. namespace Symfony\Component\Console\Descriptor;
  31582. use Symfony\Component\Console\Application;
  31583. use Symfony\Component\Console\Command\Command;
  31584. use Symfony\Component\Console\Input\InputArgument;
  31585. use Symfony\Component\Console\Input\InputDefinition;
  31586. use Symfony\Component\Console\Input\InputOption;
  31587. class JsonDescriptor extends Descriptor
  31588. {
  31589. protected function describeInputArgument(InputArgument $argument, array $options = array())
  31590. {
  31591. $this->writeData($this->getInputArgumentData($argument), $options);
  31592. }
  31593. protected function describeInputOption(InputOption $option, array $options = array())
  31594. {
  31595. $this->writeData($this->getInputOptionData($option), $options);
  31596. }
  31597. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  31598. {
  31599. $this->writeData($this->getInputDefinitionData($definition), $options);
  31600. }
  31601. protected function describeCommand(Command $command, array $options = array())
  31602. {
  31603. $this->writeData($this->getCommandData($command), $options);
  31604. }
  31605. protected function describeApplication(Application $application, array $options = array())
  31606. {
  31607. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  31608. $description = new ApplicationDescription($application, $describedNamespace);
  31609. $commands = array();
  31610. foreach ($description->getCommands() as $command) {
  31611. $commands[] = $this->getCommandData($command);
  31612. }
  31613. $data = $describedNamespace
  31614. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  31615. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  31616. $this->writeData($data, $options);
  31617. }
  31618. private function writeData(array $data, array $options)
  31619. {
  31620. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  31621. }
  31622. private function getInputArgumentData(InputArgument $argument)
  31623. {
  31624. return array(
  31625. 'name' => $argument->getName(),
  31626. 'is_required' => $argument->isRequired(),
  31627. 'is_array' => $argument->isArray(),
  31628. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  31629. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  31630. );
  31631. }
  31632. private function getInputOptionData(InputOption $option)
  31633. {
  31634. return array(
  31635. 'name' => '--'.$option->getName(),
  31636. 'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '',
  31637. 'accept_value' => $option->acceptValue(),
  31638. 'is_value_required' => $option->isValueRequired(),
  31639. 'is_multiple' => $option->isArray(),
  31640. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  31641. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  31642. );
  31643. }
  31644. private function getInputDefinitionData(InputDefinition $definition)
  31645. {
  31646. $inputArguments = array();
  31647. foreach ($definition->getArguments() as $name => $argument) {
  31648. $inputArguments[$name] = $this->getInputArgumentData($argument);
  31649. }
  31650. $inputOptions = array();
  31651. foreach ($definition->getOptions() as $name => $option) {
  31652. $inputOptions[$name] = $this->getInputOptionData($option);
  31653. }
  31654. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  31655. }
  31656. private function getCommandData(Command $command)
  31657. {
  31658. $command->getSynopsis();
  31659. $command->mergeApplicationDefinition(false);
  31660. return array(
  31661. 'name' => $command->getName(),
  31662. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  31663. 'description' => $command->getDescription(),
  31664. 'help' => $command->getProcessedHelp(),
  31665. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  31666. );
  31667. }
  31668. }
  31669. <?php
  31670. namespace Symfony\Component\Console\Descriptor;
  31671. use Symfony\Component\Console\Application;
  31672. use Symfony\Component\Console\Command\Command;
  31673. use Symfony\Component\Console\Helper\Helper;
  31674. use Symfony\Component\Console\Input\InputArgument;
  31675. use Symfony\Component\Console\Input\InputDefinition;
  31676. use Symfony\Component\Console\Input\InputOption;
  31677. class MarkdownDescriptor extends Descriptor
  31678. {
  31679. protected function describeInputArgument(InputArgument $argument, array $options = array())
  31680. {
  31681. $this->write(
  31682. '**'.$argument->getName().':**'."\n\n"
  31683. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  31684. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  31685. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  31686. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  31687. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  31688. );
  31689. }
  31690. protected function describeInputOption(InputOption $option, array $options = array())
  31691. {
  31692. $this->write(
  31693. '**'.$option->getName().':**'."\n\n"
  31694. .'* Name: `--'.$option->getName().'`'."\n"
  31695. .'* Shortcut: '.($option->getShortcut() ? '`-'.implode('|-', explode('|', $option->getShortcut())).'`' : '<none>')."\n"
  31696. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  31697. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  31698. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  31699. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  31700. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  31701. );
  31702. }
  31703. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  31704. {
  31705. if ($showArguments = count($definition->getArguments()) > 0) {
  31706. $this->write('### Arguments:');
  31707. foreach ($definition->getArguments() as $argument) {
  31708. $this->write("\n\n");
  31709. $this->write($this->describeInputArgument($argument));
  31710. }
  31711. }
  31712. if (count($definition->getOptions()) > 0) {
  31713. if ($showArguments) {
  31714. $this->write("\n\n");
  31715. }
  31716. $this->write('### Options:');
  31717. foreach ($definition->getOptions() as $option) {
  31718. $this->write("\n\n");
  31719. $this->write($this->describeInputOption($option));
  31720. }
  31721. }
  31722. }
  31723. protected function describeCommand(Command $command, array $options = array())
  31724. {
  31725. $command->getSynopsis();
  31726. $command->mergeApplicationDefinition(false);
  31727. $this->write(
  31728. $command->getName()."\n"
  31729. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  31730. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  31731. .'* Usage:'."\n\n"
  31732. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  31733. return $carry.' * `'.$usage.'`'."\n";
  31734. })
  31735. );
  31736. if ($help = $command->getProcessedHelp()) {
  31737. $this->write("\n");
  31738. $this->write($help);
  31739. }
  31740. if ($command->getNativeDefinition()) {
  31741. $this->write("\n\n");
  31742. $this->describeInputDefinition($command->getNativeDefinition());
  31743. }
  31744. }
  31745. protected function describeApplication(Application $application, array $options = array())
  31746. {
  31747. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  31748. $description = new ApplicationDescription($application, $describedNamespace);
  31749. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  31750. foreach ($description->getNamespaces() as $namespace) {
  31751. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  31752. $this->write("\n\n");
  31753. $this->write('**'.$namespace['id'].':**');
  31754. }
  31755. $this->write("\n\n");
  31756. $this->write(implode("\n", array_map(function ($commandName) {
  31757. return '* '.$commandName;
  31758. }, $namespace['commands'])));
  31759. }
  31760. foreach ($description->getCommands() as $command) {
  31761. $this->write("\n\n");
  31762. $this->write($this->describeCommand($command));
  31763. }
  31764. }
  31765. }
  31766. <?php
  31767. namespace Symfony\Component\Console\Descriptor;
  31768. use Symfony\Component\Console\Application;
  31769. use Symfony\Component\Console\Command\Command;
  31770. use Symfony\Component\Console\Formatter\OutputFormatter;
  31771. use Symfony\Component\Console\Helper\Helper;
  31772. use Symfony\Component\Console\Input\InputArgument;
  31773. use Symfony\Component\Console\Input\InputDefinition;
  31774. use Symfony\Component\Console\Input\InputOption;
  31775. class TextDescriptor extends Descriptor
  31776. {
  31777. protected function describeInputArgument(InputArgument $argument, array $options = array())
  31778. {
  31779. if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) {
  31780. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  31781. } else {
  31782. $default = '';
  31783. }
  31784. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  31785. $spacingWidth = $totalWidth - strlen($argument->getName());
  31786. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  31787. $argument->getName(),
  31788. str_repeat(' ', $spacingWidth),
  31789. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  31790. $default
  31791. ), $options);
  31792. }
  31793. protected function describeInputOption(InputOption $option, array $options = array())
  31794. {
  31795. if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) {
  31796. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  31797. } else {
  31798. $default = '';
  31799. }
  31800. $value = '';
  31801. if ($option->acceptValue()) {
  31802. $value = '='.strtoupper($option->getName());
  31803. if ($option->isValueOptional()) {
  31804. $value = '['.$value.']';
  31805. }
  31806. }
  31807. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  31808. $synopsis = sprintf('%s%s',
  31809. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  31810. sprintf('--%s%s', $option->getName(), $value)
  31811. );
  31812. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  31813. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  31814. $synopsis,
  31815. str_repeat(' ', $spacingWidth),
  31816. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  31817. $default,
  31818. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  31819. ), $options);
  31820. }
  31821. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  31822. {
  31823. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  31824. foreach ($definition->getArguments() as $argument) {
  31825. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  31826. }
  31827. if ($definition->getArguments()) {
  31828. $this->writeText('<comment>Arguments:</comment>', $options);
  31829. $this->writeText("\n");
  31830. foreach ($definition->getArguments() as $argument) {
  31831. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  31832. $this->writeText("\n");
  31833. }
  31834. }
  31835. if ($definition->getArguments() && $definition->getOptions()) {
  31836. $this->writeText("\n");
  31837. }
  31838. if ($definition->getOptions()) {
  31839. $laterOptions = array();
  31840. $this->writeText('<comment>Options:</comment>', $options);
  31841. foreach ($definition->getOptions() as $option) {
  31842. if (strlen($option->getShortcut()) > 1) {
  31843. $laterOptions[] = $option;
  31844. continue;
  31845. }
  31846. $this->writeText("\n");
  31847. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  31848. }
  31849. foreach ($laterOptions as $option) {
  31850. $this->writeText("\n");
  31851. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  31852. }
  31853. }
  31854. }
  31855. protected function describeCommand(Command $command, array $options = array())
  31856. {
  31857. $command->getSynopsis(true);
  31858. $command->getSynopsis(false);
  31859. $command->mergeApplicationDefinition(false);
  31860. $this->writeText('<comment>Usage:</comment>', $options);
  31861. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  31862. $this->writeText("\n");
  31863. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  31864. }
  31865. $this->writeText("\n");
  31866. $definition = $command->getNativeDefinition();
  31867. if ($definition->getOptions() || $definition->getArguments()) {
  31868. $this->writeText("\n");
  31869. $this->describeInputDefinition($definition, $options);
  31870. $this->writeText("\n");
  31871. }
  31872. if ($help = $command->getProcessedHelp()) {
  31873. $this->writeText("\n");
  31874. $this->writeText('<comment>Help:</comment>', $options);
  31875. $this->writeText("\n");
  31876. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  31877. $this->writeText("\n");
  31878. }
  31879. }
  31880. protected function describeApplication(Application $application, array $options = array())
  31881. {
  31882. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  31883. $description = new ApplicationDescription($application, $describedNamespace);
  31884. if (isset($options['raw_text']) && $options['raw_text']) {
  31885. $width = $this->getColumnWidth($description->getCommands());
  31886. foreach ($description->getCommands() as $command) {
  31887. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  31888. $this->writeText("\n");
  31889. }
  31890. } else {
  31891. if ('' != $help = $application->getHelp()) {
  31892. $this->writeText("$help\n\n", $options);
  31893. }
  31894. $this->writeText("<comment>Usage:</comment>\n", $options);
  31895. $this->writeText(" command [options] [arguments]\n\n", $options);
  31896. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  31897. $this->writeText("\n");
  31898. $this->writeText("\n");
  31899. $width = $this->getColumnWidth($description->getCommands());
  31900. if ($describedNamespace) {
  31901. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  31902. } else {
  31903. $this->writeText('<comment>Available commands:</comment>', $options);
  31904. }
  31905. foreach ($description->getNamespaces() as $namespace) {
  31906. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  31907. $this->writeText("\n");
  31908. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  31909. }
  31910. foreach ($namespace['commands'] as $name) {
  31911. $this->writeText("\n");
  31912. $spacingWidth = $width - Helper::strlen($name);
  31913. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  31914. }
  31915. }
  31916. $this->writeText("\n");
  31917. }
  31918. }
  31919. private function writeText($content, array $options = array())
  31920. {
  31921. $this->write(
  31922. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  31923. isset($options['raw_output']) ? !$options['raw_output'] : true
  31924. );
  31925. }
  31926. private function formatDefaultValue($default)
  31927. {
  31928. if (INF === $default) {
  31929. return 'INF';
  31930. }
  31931. if (is_string($default)) {
  31932. $default = OutputFormatter::escape($default);
  31933. } elseif (is_array($default)) {
  31934. foreach ($default as $key => $value) {
  31935. if (is_string($value)) {
  31936. $default[$key] = OutputFormatter::escape($value);
  31937. }
  31938. }
  31939. }
  31940. if (\PHP_VERSION_ID < 50400) {
  31941. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  31942. }
  31943. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  31944. }
  31945. private function getColumnWidth(array $commands)
  31946. {
  31947. $widths = array();
  31948. foreach ($commands as $command) {
  31949. $widths[] = Helper::strlen($command->getName());
  31950. foreach ($command->getAliases() as $alias) {
  31951. $widths[] = Helper::strlen($alias);
  31952. }
  31953. }
  31954. return max($widths) + 2;
  31955. }
  31956. private function calculateTotalWidthForOptions(array $options)
  31957. {
  31958. $totalWidth = 0;
  31959. foreach ($options as $option) {
  31960. $nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  31961. if ($option->acceptValue()) {
  31962. $valueLength = 1 + Helper::strlen($option->getName());
  31963. $valueLength += $option->isValueOptional() ? 2 : 0;
  31964. $nameLength += $valueLength;
  31965. }
  31966. $totalWidth = max($totalWidth, $nameLength);
  31967. }
  31968. return $totalWidth;
  31969. }
  31970. }
  31971. <?php
  31972. namespace Symfony\Component\Console\Descriptor;
  31973. use Symfony\Component\Console\Application;
  31974. use Symfony\Component\Console\Command\Command;
  31975. use Symfony\Component\Console\Input\InputArgument;
  31976. use Symfony\Component\Console\Input\InputDefinition;
  31977. use Symfony\Component\Console\Input\InputOption;
  31978. class XmlDescriptor extends Descriptor
  31979. {
  31980. public function getInputDefinitionDocument(InputDefinition $definition)
  31981. {
  31982. $dom = new \DOMDocument('1.0', 'UTF-8');
  31983. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  31984. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  31985. foreach ($definition->getArguments() as $argument) {
  31986. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  31987. }
  31988. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  31989. foreach ($definition->getOptions() as $option) {
  31990. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  31991. }
  31992. return $dom;
  31993. }
  31994. public function getCommandDocument(Command $command)
  31995. {
  31996. $dom = new \DOMDocument('1.0', 'UTF-8');
  31997. $dom->appendChild($commandXML = $dom->createElement('command'));
  31998. $command->getSynopsis();
  31999. $command->mergeApplicationDefinition(false);
  32000. $commandXML->setAttribute('id', $command->getName());
  32001. $commandXML->setAttribute('name', $command->getName());
  32002. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  32003. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  32004. $usagesXML->appendChild($dom->createElement('usage', $usage));
  32005. }
  32006. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  32007. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  32008. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  32009. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  32010. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  32011. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  32012. return $dom;
  32013. }
  32014. public function getApplicationDocument(Application $application, $namespace = null)
  32015. {
  32016. $dom = new \DOMDocument('1.0', 'UTF-8');
  32017. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  32018. if ('UNKNOWN' !== $application->getName()) {
  32019. $rootXml->setAttribute('name', $application->getName());
  32020. if ('UNKNOWN' !== $application->getVersion()) {
  32021. $rootXml->setAttribute('version', $application->getVersion());
  32022. }
  32023. }
  32024. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  32025. $description = new ApplicationDescription($application, $namespace);
  32026. if ($namespace) {
  32027. $commandsXML->setAttribute('namespace', $namespace);
  32028. }
  32029. foreach ($description->getCommands() as $command) {
  32030. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  32031. }
  32032. if (!$namespace) {
  32033. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  32034. foreach ($description->getNamespaces() as $namespaceDescription) {
  32035. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  32036. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  32037. foreach ($namespaceDescription['commands'] as $name) {
  32038. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  32039. $commandXML->appendChild($dom->createTextNode($name));
  32040. }
  32041. }
  32042. }
  32043. return $dom;
  32044. }
  32045. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32046. {
  32047. $this->writeDocument($this->getInputArgumentDocument($argument));
  32048. }
  32049. protected function describeInputOption(InputOption $option, array $options = array())
  32050. {
  32051. $this->writeDocument($this->getInputOptionDocument($option));
  32052. }
  32053. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32054. {
  32055. $this->writeDocument($this->getInputDefinitionDocument($definition));
  32056. }
  32057. protected function describeCommand(Command $command, array $options = array())
  32058. {
  32059. $this->writeDocument($this->getCommandDocument($command));
  32060. }
  32061. protected function describeApplication(Application $application, array $options = array())
  32062. {
  32063. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  32064. }
  32065. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  32066. {
  32067. foreach ($importedParent->childNodes as $childNode) {
  32068. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  32069. }
  32070. }
  32071. private function writeDocument(\DOMDocument $dom)
  32072. {
  32073. $dom->formatOutput = true;
  32074. $this->write($dom->saveXML());
  32075. }
  32076. private function getInputArgumentDocument(InputArgument $argument)
  32077. {
  32078. $dom = new \DOMDocument('1.0', 'UTF-8');
  32079. $dom->appendChild($objectXML = $dom->createElement('argument'));
  32080. $objectXML->setAttribute('name', $argument->getName());
  32081. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  32082. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  32083. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  32084. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  32085. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  32086. $defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  32087. foreach ($defaults as $default) {
  32088. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  32089. $defaultXML->appendChild($dom->createTextNode($default));
  32090. }
  32091. return $dom;
  32092. }
  32093. private function getInputOptionDocument(InputOption $option)
  32094. {
  32095. $dom = new \DOMDocument('1.0', 'UTF-8');
  32096. $dom->appendChild($objectXML = $dom->createElement('option'));
  32097. $objectXML->setAttribute('name', '--'.$option->getName());
  32098. $pos = strpos($option->getShortcut(), '|');
  32099. if (false !== $pos) {
  32100. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  32101. $objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut())));
  32102. } else {
  32103. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  32104. }
  32105. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  32106. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  32107. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  32108. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  32109. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  32110. if ($option->acceptValue()) {
  32111. $defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  32112. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  32113. if (!empty($defaults)) {
  32114. foreach ($defaults as $default) {
  32115. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  32116. $defaultXML->appendChild($dom->createTextNode($default));
  32117. }
  32118. }
  32119. }
  32120. return $dom;
  32121. }
  32122. }
  32123. <?php
  32124. namespace Symfony\Component\Console\Event;
  32125. class ConsoleCommandEvent extends ConsoleEvent
  32126. {
  32127. const RETURN_CODE_DISABLED = 113;
  32128. private $commandShouldRun = true;
  32129. public function disableCommand()
  32130. {
  32131. return $this->commandShouldRun = false;
  32132. }
  32133. public function enableCommand()
  32134. {
  32135. return $this->commandShouldRun = true;
  32136. }
  32137. public function commandShouldRun()
  32138. {
  32139. return $this->commandShouldRun;
  32140. }
  32141. }
  32142. <?php
  32143. namespace Symfony\Component\Console\Event;
  32144. use Symfony\Component\Console\Command\Command;
  32145. use Symfony\Component\Console\Input\InputInterface;
  32146. use Symfony\Component\Console\Output\OutputInterface;
  32147. use Symfony\Component\EventDispatcher\Event;
  32148. class ConsoleEvent extends Event
  32149. {
  32150. protected $command;
  32151. private $input;
  32152. private $output;
  32153. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  32154. {
  32155. $this->command = $command;
  32156. $this->input = $input;
  32157. $this->output = $output;
  32158. }
  32159. public function getCommand()
  32160. {
  32161. return $this->command;
  32162. }
  32163. public function getInput()
  32164. {
  32165. return $this->input;
  32166. }
  32167. public function getOutput()
  32168. {
  32169. return $this->output;
  32170. }
  32171. }
  32172. <?php
  32173. namespace Symfony\Component\Console\Event;
  32174. use Symfony\Component\Console\Command\Command;
  32175. use Symfony\Component\Console\Input\InputInterface;
  32176. use Symfony\Component\Console\Output\OutputInterface;
  32177. class ConsoleExceptionEvent extends ConsoleEvent
  32178. {
  32179. private $exception;
  32180. private $exitCode;
  32181. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  32182. {
  32183. parent::__construct($command, $input, $output);
  32184. $this->setException($exception);
  32185. $this->exitCode = (int) $exitCode;
  32186. }
  32187. public function getException()
  32188. {
  32189. return $this->exception;
  32190. }
  32191. public function setException(\Exception $exception)
  32192. {
  32193. $this->exception = $exception;
  32194. }
  32195. public function getExitCode()
  32196. {
  32197. return $this->exitCode;
  32198. }
  32199. }
  32200. <?php
  32201. namespace Symfony\Component\Console\Event;
  32202. use Symfony\Component\Console\Command\Command;
  32203. use Symfony\Component\Console\Input\InputInterface;
  32204. use Symfony\Component\Console\Output\OutputInterface;
  32205. class ConsoleTerminateEvent extends ConsoleEvent
  32206. {
  32207. private $exitCode;
  32208. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  32209. {
  32210. parent::__construct($command, $input, $output);
  32211. $this->setExitCode($exitCode);
  32212. }
  32213. public function setExitCode($exitCode)
  32214. {
  32215. $this->exitCode = (int) $exitCode;
  32216. }
  32217. public function getExitCode()
  32218. {
  32219. return $this->exitCode;
  32220. }
  32221. }
  32222. <?php
  32223. namespace Symfony\Component\Console\Exception;
  32224. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  32225. {
  32226. private $alternatives;
  32227. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  32228. {
  32229. parent::__construct($message, $code, $previous);
  32230. $this->alternatives = $alternatives;
  32231. }
  32232. public function getAlternatives()
  32233. {
  32234. return $this->alternatives;
  32235. }
  32236. }
  32237. <?php
  32238. namespace Symfony\Component\Console\Exception;
  32239. interface ExceptionInterface
  32240. {
  32241. }
  32242. <?php
  32243. namespace Symfony\Component\Console\Exception;
  32244. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  32245. {
  32246. }
  32247. <?php
  32248. namespace Symfony\Component\Console\Exception;
  32249. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  32250. {
  32251. }
  32252. <?php
  32253. namespace Symfony\Component\Console\Exception;
  32254. class LogicException extends \LogicException implements ExceptionInterface
  32255. {
  32256. }
  32257. <?php
  32258. namespace Symfony\Component\Console\Exception;
  32259. class RuntimeException extends \RuntimeException implements ExceptionInterface
  32260. {
  32261. }
  32262. <?php
  32263. namespace Symfony\Component\Console\Formatter;
  32264. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32265. class OutputFormatter implements OutputFormatterInterface
  32266. {
  32267. private $decorated;
  32268. private $styles = array();
  32269. private $styleStack;
  32270. public static function escape($text)
  32271. {
  32272. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  32273. return self::escapeTrailingBackslash($text);
  32274. }
  32275. public static function escapeTrailingBackslash($text)
  32276. {
  32277. if ('\\' === substr($text, -1)) {
  32278. $len = strlen($text);
  32279. $text = rtrim($text, '\\');
  32280. $text = str_replace("\0", '', $text);
  32281. $text .= str_repeat("\0", $len - strlen($text));
  32282. }
  32283. return $text;
  32284. }
  32285. public function __construct($decorated = false, array $styles = array())
  32286. {
  32287. $this->decorated = (bool) $decorated;
  32288. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  32289. $this->setStyle('info', new OutputFormatterStyle('green'));
  32290. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  32291. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  32292. foreach ($styles as $name => $style) {
  32293. $this->setStyle($name, $style);
  32294. }
  32295. $this->styleStack = new OutputFormatterStyleStack();
  32296. }
  32297. public function setDecorated($decorated)
  32298. {
  32299. $this->decorated = (bool) $decorated;
  32300. }
  32301. public function isDecorated()
  32302. {
  32303. return $this->decorated;
  32304. }
  32305. public function setStyle($name, OutputFormatterStyleInterface $style)
  32306. {
  32307. $this->styles[strtolower($name)] = $style;
  32308. }
  32309. public function hasStyle($name)
  32310. {
  32311. return isset($this->styles[strtolower($name)]);
  32312. }
  32313. public function getStyle($name)
  32314. {
  32315. if (!$this->hasStyle($name)) {
  32316. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  32317. }
  32318. return $this->styles[strtolower($name)];
  32319. }
  32320. public function format($message)
  32321. {
  32322. $message = (string) $message;
  32323. $offset = 0;
  32324. $output = '';
  32325. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  32326. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  32327. foreach ($matches[0] as $i => $match) {
  32328. $pos = $match[1];
  32329. $text = $match[0];
  32330. if (0 != $pos && '\\' == $message[$pos - 1]) {
  32331. continue;
  32332. }
  32333. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  32334. $offset = $pos + strlen($text);
  32335. if ($open = '/' != $text[1]) {
  32336. $tag = $matches[1][$i][0];
  32337. } else {
  32338. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  32339. }
  32340. if (!$open && !$tag) {
  32341. $this->styleStack->pop();
  32342. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  32343. $output .= $this->applyCurrentStyle($text);
  32344. } elseif ($open) {
  32345. $this->styleStack->push($style);
  32346. } else {
  32347. $this->styleStack->pop($style);
  32348. }
  32349. }
  32350. $output .= $this->applyCurrentStyle(substr($message, $offset));
  32351. if (false !== strpos($output, "\0")) {
  32352. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  32353. }
  32354. return str_replace('\\<', '<', $output);
  32355. }
  32356. public function getStyleStack()
  32357. {
  32358. return $this->styleStack;
  32359. }
  32360. private function createStyleFromString($string)
  32361. {
  32362. if (isset($this->styles[$string])) {
  32363. return $this->styles[$string];
  32364. }
  32365. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  32366. return false;
  32367. }
  32368. $style = new OutputFormatterStyle();
  32369. foreach ($matches as $match) {
  32370. array_shift($match);
  32371. if ('fg' == $match[0]) {
  32372. $style->setForeground($match[1]);
  32373. } elseif ('bg' == $match[0]) {
  32374. $style->setBackground($match[1]);
  32375. } else {
  32376. try {
  32377. $style->setOption($match[1]);
  32378. } catch (\InvalidArgumentException $e) {
  32379. return false;
  32380. }
  32381. }
  32382. }
  32383. return $style;
  32384. }
  32385. private function applyCurrentStyle($text)
  32386. {
  32387. return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  32388. }
  32389. }
  32390. <?php
  32391. namespace Symfony\Component\Console\Formatter;
  32392. interface OutputFormatterInterface
  32393. {
  32394. public function setDecorated($decorated);
  32395. public function isDecorated();
  32396. public function setStyle($name, OutputFormatterStyleInterface $style);
  32397. public function hasStyle($name);
  32398. public function getStyle($name);
  32399. public function format($message);
  32400. }
  32401. <?php
  32402. namespace Symfony\Component\Console\Formatter;
  32403. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32404. class OutputFormatterStyle implements OutputFormatterStyleInterface
  32405. {
  32406. private static $availableForegroundColors = array(
  32407. 'black' => array('set' => 30, 'unset' => 39),
  32408. 'red' => array('set' => 31, 'unset' => 39),
  32409. 'green' => array('set' => 32, 'unset' => 39),
  32410. 'yellow' => array('set' => 33, 'unset' => 39),
  32411. 'blue' => array('set' => 34, 'unset' => 39),
  32412. 'magenta' => array('set' => 35, 'unset' => 39),
  32413. 'cyan' => array('set' => 36, 'unset' => 39),
  32414. 'white' => array('set' => 37, 'unset' => 39),
  32415. 'default' => array('set' => 39, 'unset' => 39),
  32416. );
  32417. private static $availableBackgroundColors = array(
  32418. 'black' => array('set' => 40, 'unset' => 49),
  32419. 'red' => array('set' => 41, 'unset' => 49),
  32420. 'green' => array('set' => 42, 'unset' => 49),
  32421. 'yellow' => array('set' => 43, 'unset' => 49),
  32422. 'blue' => array('set' => 44, 'unset' => 49),
  32423. 'magenta' => array('set' => 45, 'unset' => 49),
  32424. 'cyan' => array('set' => 46, 'unset' => 49),
  32425. 'white' => array('set' => 47, 'unset' => 49),
  32426. 'default' => array('set' => 49, 'unset' => 49),
  32427. );
  32428. private static $availableOptions = array(
  32429. 'bold' => array('set' => 1, 'unset' => 22),
  32430. 'underscore' => array('set' => 4, 'unset' => 24),
  32431. 'blink' => array('set' => 5, 'unset' => 25),
  32432. 'reverse' => array('set' => 7, 'unset' => 27),
  32433. 'conceal' => array('set' => 8, 'unset' => 28),
  32434. );
  32435. private $foreground;
  32436. private $background;
  32437. private $options = array();
  32438. public function __construct($foreground = null, $background = null, array $options = array())
  32439. {
  32440. if (null !== $foreground) {
  32441. $this->setForeground($foreground);
  32442. }
  32443. if (null !== $background) {
  32444. $this->setBackground($background);
  32445. }
  32446. if (count($options)) {
  32447. $this->setOptions($options);
  32448. }
  32449. }
  32450. public function setForeground($color = null)
  32451. {
  32452. if (null === $color) {
  32453. $this->foreground = null;
  32454. return;
  32455. }
  32456. if (!isset(static::$availableForegroundColors[$color])) {
  32457. throw new InvalidArgumentException(sprintf(
  32458. 'Invalid foreground color specified: "%s". Expected one of (%s)',
  32459. $color,
  32460. implode(', ', array_keys(static::$availableForegroundColors))
  32461. ));
  32462. }
  32463. $this->foreground = static::$availableForegroundColors[$color];
  32464. }
  32465. public function setBackground($color = null)
  32466. {
  32467. if (null === $color) {
  32468. $this->background = null;
  32469. return;
  32470. }
  32471. if (!isset(static::$availableBackgroundColors[$color])) {
  32472. throw new InvalidArgumentException(sprintf(
  32473. 'Invalid background color specified: "%s". Expected one of (%s)',
  32474. $color,
  32475. implode(', ', array_keys(static::$availableBackgroundColors))
  32476. ));
  32477. }
  32478. $this->background = static::$availableBackgroundColors[$color];
  32479. }
  32480. public function setOption($option)
  32481. {
  32482. if (!isset(static::$availableOptions[$option])) {
  32483. throw new InvalidArgumentException(sprintf(
  32484. 'Invalid option specified: "%s". Expected one of (%s)',
  32485. $option,
  32486. implode(', ', array_keys(static::$availableOptions))
  32487. ));
  32488. }
  32489. if (!in_array(static::$availableOptions[$option], $this->options)) {
  32490. $this->options[] = static::$availableOptions[$option];
  32491. }
  32492. }
  32493. public function unsetOption($option)
  32494. {
  32495. if (!isset(static::$availableOptions[$option])) {
  32496. throw new InvalidArgumentException(sprintf(
  32497. 'Invalid option specified: "%s". Expected one of (%s)',
  32498. $option,
  32499. implode(', ', array_keys(static::$availableOptions))
  32500. ));
  32501. }
  32502. $pos = array_search(static::$availableOptions[$option], $this->options);
  32503. if (false !== $pos) {
  32504. unset($this->options[$pos]);
  32505. }
  32506. }
  32507. public function setOptions(array $options)
  32508. {
  32509. $this->options = array();
  32510. foreach ($options as $option) {
  32511. $this->setOption($option);
  32512. }
  32513. }
  32514. public function apply($text)
  32515. {
  32516. $setCodes = array();
  32517. $unsetCodes = array();
  32518. if (null !== $this->foreground) {
  32519. $setCodes[] = $this->foreground['set'];
  32520. $unsetCodes[] = $this->foreground['unset'];
  32521. }
  32522. if (null !== $this->background) {
  32523. $setCodes[] = $this->background['set'];
  32524. $unsetCodes[] = $this->background['unset'];
  32525. }
  32526. if (count($this->options)) {
  32527. foreach ($this->options as $option) {
  32528. $setCodes[] = $option['set'];
  32529. $unsetCodes[] = $option['unset'];
  32530. }
  32531. }
  32532. if (0 === count($setCodes)) {
  32533. return $text;
  32534. }
  32535. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  32536. }
  32537. }
  32538. <?php
  32539. namespace Symfony\Component\Console\Formatter;
  32540. interface OutputFormatterStyleInterface
  32541. {
  32542. public function setForeground($color = null);
  32543. public function setBackground($color = null);
  32544. public function setOption($option);
  32545. public function unsetOption($option);
  32546. public function setOptions(array $options);
  32547. public function apply($text);
  32548. }
  32549. <?php
  32550. namespace Symfony\Component\Console\Formatter;
  32551. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32552. class OutputFormatterStyleStack
  32553. {
  32554. private $styles;
  32555. private $emptyStyle;
  32556. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  32557. {
  32558. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  32559. $this->reset();
  32560. }
  32561. public function reset()
  32562. {
  32563. $this->styles = array();
  32564. }
  32565. public function push(OutputFormatterStyleInterface $style)
  32566. {
  32567. $this->styles[] = $style;
  32568. }
  32569. public function pop(OutputFormatterStyleInterface $style = null)
  32570. {
  32571. if (empty($this->styles)) {
  32572. return $this->emptyStyle;
  32573. }
  32574. if (null === $style) {
  32575. return array_pop($this->styles);
  32576. }
  32577. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  32578. if ($style->apply('') === $stackedStyle->apply('')) {
  32579. $this->styles = array_slice($this->styles, 0, $index);
  32580. return $stackedStyle;
  32581. }
  32582. }
  32583. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  32584. }
  32585. public function getCurrent()
  32586. {
  32587. if (empty($this->styles)) {
  32588. return $this->emptyStyle;
  32589. }
  32590. return $this->styles[count($this->styles) - 1];
  32591. }
  32592. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  32593. {
  32594. $this->emptyStyle = $emptyStyle;
  32595. return $this;
  32596. }
  32597. public function getEmptyStyle()
  32598. {
  32599. return $this->emptyStyle;
  32600. }
  32601. }
  32602. <?php
  32603. namespace Symfony\Component\Console\Helper;
  32604. class DebugFormatterHelper extends Helper
  32605. {
  32606. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  32607. private $started = array();
  32608. private $count = -1;
  32609. public function start($id, $message, $prefix = 'RUN')
  32610. {
  32611. $this->started[$id] = array('border' => ++$this->count % count($this->colors));
  32612. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  32613. }
  32614. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  32615. {
  32616. $message = '';
  32617. if ($error) {
  32618. if (isset($this->started[$id]['out'])) {
  32619. $message .= "\n";
  32620. unset($this->started[$id]['out']);
  32621. }
  32622. if (!isset($this->started[$id]['err'])) {
  32623. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  32624. $this->started[$id]['err'] = true;
  32625. }
  32626. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  32627. } else {
  32628. if (isset($this->started[$id]['err'])) {
  32629. $message .= "\n";
  32630. unset($this->started[$id]['err']);
  32631. }
  32632. if (!isset($this->started[$id]['out'])) {
  32633. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  32634. $this->started[$id]['out'] = true;
  32635. }
  32636. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  32637. }
  32638. return $message;
  32639. }
  32640. public function stop($id, $message, $successful, $prefix = 'RES')
  32641. {
  32642. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  32643. if ($successful) {
  32644. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  32645. }
  32646. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  32647. unset($this->started[$id]['out'], $this->started[$id]['err']);
  32648. return $message;
  32649. }
  32650. private function getBorder($id)
  32651. {
  32652. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  32653. }
  32654. public function getName()
  32655. {
  32656. return 'debug_formatter';
  32657. }
  32658. }
  32659. <?php
  32660. namespace Symfony\Component\Console\Helper;
  32661. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  32662. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  32663. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  32664. use Symfony\Component\Console\Descriptor\TextDescriptor;
  32665. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  32666. use Symfony\Component\Console\Output\OutputInterface;
  32667. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32668. class DescriptorHelper extends Helper
  32669. {
  32670. private $descriptors = array();
  32671. public function __construct()
  32672. {
  32673. $this
  32674. ->register('txt', new TextDescriptor())
  32675. ->register('xml', new XmlDescriptor())
  32676. ->register('json', new JsonDescriptor())
  32677. ->register('md', new MarkdownDescriptor())
  32678. ;
  32679. }
  32680. public function describe(OutputInterface $output, $object, array $options = array())
  32681. {
  32682. $options = array_merge(array(
  32683. 'raw_text' => false,
  32684. 'format' => 'txt',
  32685. ), $options);
  32686. if (!isset($this->descriptors[$options['format']])) {
  32687. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  32688. }
  32689. $descriptor = $this->descriptors[$options['format']];
  32690. $descriptor->describe($output, $object, $options);
  32691. }
  32692. public function register($format, DescriptorInterface $descriptor)
  32693. {
  32694. $this->descriptors[$format] = $descriptor;
  32695. return $this;
  32696. }
  32697. public function getName()
  32698. {
  32699. return 'descriptor';
  32700. }
  32701. }
  32702. <?php
  32703. namespace Symfony\Component\Console\Helper;
  32704. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32705. use Symfony\Component\Console\Exception\RuntimeException;
  32706. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  32707. use Symfony\Component\Console\Output\OutputInterface;
  32708. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  32709. class DialogHelper extends InputAwareHelper
  32710. {
  32711. private $inputStream;
  32712. private static $shell;
  32713. private static $stty;
  32714. public function __construct($triggerDeprecationError = true)
  32715. {
  32716. if ($triggerDeprecationError) {
  32717. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  32718. }
  32719. }
  32720. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  32721. {
  32722. if ($output instanceof ConsoleOutputInterface) {
  32723. $output = $output->getErrorOutput();
  32724. }
  32725. $width = max(array_map('strlen', array_keys($choices)));
  32726. $messages = (array) $question;
  32727. foreach ($choices as $key => $value) {
  32728. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  32729. }
  32730. $output->writeln($messages);
  32731. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  32732. $selectedChoices = str_replace(' ', '', $picked);
  32733. if ($multiselect) {
  32734. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  32735. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  32736. }
  32737. $selectedChoices = explode(',', $selectedChoices);
  32738. } else {
  32739. $selectedChoices = array($picked);
  32740. }
  32741. $multiselectChoices = array();
  32742. foreach ($selectedChoices as $value) {
  32743. if (empty($choices[$value])) {
  32744. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  32745. }
  32746. $multiselectChoices[] = $value;
  32747. }
  32748. if ($multiselect) {
  32749. return $multiselectChoices;
  32750. }
  32751. return $picked;
  32752. }, $attempts, $default);
  32753. return $result;
  32754. }
  32755. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  32756. {
  32757. if ($this->input && !$this->input->isInteractive()) {
  32758. return $default;
  32759. }
  32760. if ($output instanceof ConsoleOutputInterface) {
  32761. $output = $output->getErrorOutput();
  32762. }
  32763. $output->write($question);
  32764. $inputStream = $this->inputStream ?: STDIN;
  32765. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  32766. $ret = fgets($inputStream, 4096);
  32767. if (false === $ret) {
  32768. throw new RuntimeException('Aborted');
  32769. }
  32770. $ret = trim($ret);
  32771. } else {
  32772. $ret = '';
  32773. $i = 0;
  32774. $ofs = -1;
  32775. $matches = $autocomplete;
  32776. $numMatches = count($matches);
  32777. $sttyMode = shell_exec('stty -g');
  32778. shell_exec('stty -icanon -echo');
  32779. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  32780. while (!feof($inputStream)) {
  32781. $c = fread($inputStream, 1);
  32782. if ("\177" === $c) {
  32783. if (0 === $numMatches && 0 !== $i) {
  32784. --$i;
  32785. $output->write("\033[1D");
  32786. }
  32787. if (0 === $i) {
  32788. $ofs = -1;
  32789. $matches = $autocomplete;
  32790. $numMatches = count($matches);
  32791. } else {
  32792. $numMatches = 0;
  32793. }
  32794. $ret = substr($ret, 0, $i);
  32795. } elseif ("\033" === $c) {
  32796. $c .= fread($inputStream, 2);
  32797. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  32798. if ('A' === $c[2] && -1 === $ofs) {
  32799. $ofs = 0;
  32800. }
  32801. if (0 === $numMatches) {
  32802. continue;
  32803. }
  32804. $ofs += ('A' === $c[2]) ? -1 : 1;
  32805. $ofs = ($numMatches + $ofs) % $numMatches;
  32806. }
  32807. } elseif (ord($c) < 32) {
  32808. if ("\t" === $c || "\n" === $c) {
  32809. if ($numMatches > 0 && -1 !== $ofs) {
  32810. $ret = $matches[$ofs];
  32811. $output->write(substr($ret, $i));
  32812. $i = strlen($ret);
  32813. }
  32814. if ("\n" === $c) {
  32815. $output->write($c);
  32816. break;
  32817. }
  32818. $numMatches = 0;
  32819. }
  32820. continue;
  32821. } else {
  32822. $output->write($c);
  32823. $ret .= $c;
  32824. ++$i;
  32825. $numMatches = 0;
  32826. $ofs = 0;
  32827. foreach ($autocomplete as $value) {
  32828. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  32829. $matches[$numMatches++] = $value;
  32830. }
  32831. }
  32832. }
  32833. $output->write("\033[K");
  32834. if ($numMatches > 0 && -1 !== $ofs) {
  32835. $output->write("\0337");
  32836. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  32837. $output->write("\0338");
  32838. }
  32839. }
  32840. shell_exec(sprintf('stty %s', $sttyMode));
  32841. }
  32842. return strlen($ret) > 0 ? $ret : $default;
  32843. }
  32844. public function askConfirmation(OutputInterface $output, $question, $default = true)
  32845. {
  32846. $answer = 'z';
  32847. while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) {
  32848. $answer = $this->ask($output, $question);
  32849. }
  32850. if (false === $default) {
  32851. return $answer && 'y' == strtolower($answer[0]);
  32852. }
  32853. return !$answer || 'y' == strtolower($answer[0]);
  32854. }
  32855. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  32856. {
  32857. if ($output instanceof ConsoleOutputInterface) {
  32858. $output = $output->getErrorOutput();
  32859. }
  32860. if ('\\' === DIRECTORY_SEPARATOR) {
  32861. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  32862. if ('phar:' === substr(__FILE__, 0, 5)) {
  32863. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  32864. copy($exe, $tmpExe);
  32865. $exe = $tmpExe;
  32866. }
  32867. $output->write($question);
  32868. $value = rtrim(shell_exec($exe));
  32869. $output->writeln('');
  32870. if (isset($tmpExe)) {
  32871. unlink($tmpExe);
  32872. }
  32873. return $value;
  32874. }
  32875. if ($this->hasSttyAvailable()) {
  32876. $output->write($question);
  32877. $sttyMode = shell_exec('stty -g');
  32878. shell_exec('stty -echo');
  32879. $value = fgets($this->inputStream ?: STDIN, 4096);
  32880. shell_exec(sprintf('stty %s', $sttyMode));
  32881. if (false === $value) {
  32882. throw new RuntimeException('Aborted');
  32883. }
  32884. $value = trim($value);
  32885. $output->writeln('');
  32886. return $value;
  32887. }
  32888. if (false !== $shell = $this->getShell()) {
  32889. $output->write($question);
  32890. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  32891. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  32892. $value = rtrim(shell_exec($command));
  32893. $output->writeln('');
  32894. return $value;
  32895. }
  32896. if ($fallback) {
  32897. return $this->ask($output, $question);
  32898. }
  32899. throw new RuntimeException('Unable to hide the response');
  32900. }
  32901. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  32902. {
  32903. $that = $this;
  32904. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  32905. return $that->ask($output, $question, $default, $autocomplete);
  32906. };
  32907. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  32908. }
  32909. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  32910. {
  32911. $that = $this;
  32912. $interviewer = function () use ($output, $question, $fallback, $that) {
  32913. return $that->askHiddenResponse($output, $question, $fallback);
  32914. };
  32915. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  32916. }
  32917. public function setInputStream($stream)
  32918. {
  32919. $this->inputStream = $stream;
  32920. }
  32921. public function getInputStream()
  32922. {
  32923. return $this->inputStream;
  32924. }
  32925. public function getName()
  32926. {
  32927. return 'dialog';
  32928. }
  32929. private function getShell()
  32930. {
  32931. if (null !== self::$shell) {
  32932. return self::$shell;
  32933. }
  32934. self::$shell = false;
  32935. if (file_exists('/usr/bin/env')) {
  32936. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  32937. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  32938. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  32939. self::$shell = $sh;
  32940. break;
  32941. }
  32942. }
  32943. }
  32944. return self::$shell;
  32945. }
  32946. private function hasSttyAvailable()
  32947. {
  32948. if (null !== self::$stty) {
  32949. return self::$stty;
  32950. }
  32951. exec('stty 2>&1', $output, $exitcode);
  32952. return self::$stty = 0 === $exitcode;
  32953. }
  32954. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  32955. {
  32956. if ($output instanceof ConsoleOutputInterface) {
  32957. $output = $output->getErrorOutput();
  32958. }
  32959. $e = null;
  32960. while (false === $attempts || $attempts--) {
  32961. if (null !== $e) {
  32962. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  32963. }
  32964. try {
  32965. return call_user_func($validator, $interviewer());
  32966. } catch (\Exception $e) {
  32967. }
  32968. }
  32969. throw $e;
  32970. }
  32971. }
  32972. <?php
  32973. namespace Symfony\Component\Console\Helper;
  32974. use Symfony\Component\Console\Formatter\OutputFormatter;
  32975. class FormatterHelper extends Helper
  32976. {
  32977. public function formatSection($section, $message, $style = 'info')
  32978. {
  32979. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  32980. }
  32981. public function formatBlock($messages, $style, $large = false)
  32982. {
  32983. if (!is_array($messages)) {
  32984. $messages = array($messages);
  32985. }
  32986. $len = 0;
  32987. $lines = array();
  32988. foreach ($messages as $message) {
  32989. $message = OutputFormatter::escape($message);
  32990. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  32991. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  32992. }
  32993. $messages = $large ? array(str_repeat(' ', $len)) : array();
  32994. for ($i = 0; isset($lines[$i]); ++$i) {
  32995. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  32996. }
  32997. if ($large) {
  32998. $messages[] = str_repeat(' ', $len);
  32999. }
  33000. for ($i = 0; isset($messages[$i]); ++$i) {
  33001. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  33002. }
  33003. return implode("\n", $messages);
  33004. }
  33005. public function getName()
  33006. {
  33007. return 'formatter';
  33008. }
  33009. }
  33010. <?php
  33011. namespace Symfony\Component\Console\Helper;
  33012. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33013. abstract class Helper implements HelperInterface
  33014. {
  33015. protected $helperSet = null;
  33016. public function setHelperSet(HelperSet $helperSet = null)
  33017. {
  33018. $this->helperSet = $helperSet;
  33019. }
  33020. public function getHelperSet()
  33021. {
  33022. return $this->helperSet;
  33023. }
  33024. public static function strlen($string)
  33025. {
  33026. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  33027. return strlen($string);
  33028. }
  33029. return mb_strwidth($string, $encoding);
  33030. }
  33031. public static function formatTime($secs)
  33032. {
  33033. static $timeFormats = array(
  33034. array(0, '< 1 sec'),
  33035. array(1, '1 sec'),
  33036. array(2, 'secs', 1),
  33037. array(60, '1 min'),
  33038. array(120, 'mins', 60),
  33039. array(3600, '1 hr'),
  33040. array(7200, 'hrs', 3600),
  33041. array(86400, '1 day'),
  33042. array(172800, 'days', 86400),
  33043. );
  33044. foreach ($timeFormats as $index => $format) {
  33045. if ($secs >= $format[0]) {
  33046. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  33047. || $index == count($timeFormats) - 1
  33048. ) {
  33049. if (2 == count($format)) {
  33050. return $format[1];
  33051. }
  33052. return floor($secs / $format[2]).' '.$format[1];
  33053. }
  33054. }
  33055. }
  33056. }
  33057. public static function formatMemory($memory)
  33058. {
  33059. if ($memory >= 1024 * 1024 * 1024) {
  33060. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  33061. }
  33062. if ($memory >= 1024 * 1024) {
  33063. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  33064. }
  33065. if ($memory >= 1024) {
  33066. return sprintf('%d KiB', $memory / 1024);
  33067. }
  33068. return sprintf('%d B', $memory);
  33069. }
  33070. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  33071. {
  33072. return self::strlen(self::removeDecoration($formatter, $string));
  33073. }
  33074. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  33075. {
  33076. $isDecorated = $formatter->isDecorated();
  33077. $formatter->setDecorated(false);
  33078. $string = $formatter->format($string);
  33079. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  33080. $formatter->setDecorated($isDecorated);
  33081. return $string;
  33082. }
  33083. }
  33084. <?php
  33085. namespace Symfony\Component\Console\Helper;
  33086. interface HelperInterface
  33087. {
  33088. public function setHelperSet(HelperSet $helperSet = null);
  33089. public function getHelperSet();
  33090. public function getName();
  33091. }
  33092. <?php
  33093. namespace Symfony\Component\Console\Helper;
  33094. use Symfony\Component\Console\Command\Command;
  33095. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33096. class HelperSet implements \IteratorAggregate
  33097. {
  33098. private $helpers = array();
  33099. private $command;
  33100. public function __construct(array $helpers = array())
  33101. {
  33102. foreach ($helpers as $alias => $helper) {
  33103. $this->set($helper, is_int($alias) ? null : $alias);
  33104. }
  33105. }
  33106. public function set(HelperInterface $helper, $alias = null)
  33107. {
  33108. $this->helpers[$helper->getName()] = $helper;
  33109. if (null !== $alias) {
  33110. $this->helpers[$alias] = $helper;
  33111. }
  33112. $helper->setHelperSet($this);
  33113. }
  33114. public function has($name)
  33115. {
  33116. return isset($this->helpers[$name]);
  33117. }
  33118. public function get($name)
  33119. {
  33120. if (!$this->has($name)) {
  33121. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  33122. }
  33123. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  33124. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  33125. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  33126. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  33127. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  33128. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  33129. }
  33130. return $this->helpers[$name];
  33131. }
  33132. public function setCommand(Command $command = null)
  33133. {
  33134. $this->command = $command;
  33135. }
  33136. public function getCommand()
  33137. {
  33138. return $this->command;
  33139. }
  33140. public function getIterator()
  33141. {
  33142. return new \ArrayIterator($this->helpers);
  33143. }
  33144. }
  33145. <?php
  33146. namespace Symfony\Component\Console\Helper;
  33147. use Symfony\Component\Console\Input\InputInterface;
  33148. use Symfony\Component\Console\Input\InputAwareInterface;
  33149. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  33150. {
  33151. protected $input;
  33152. public function setInput(InputInterface $input)
  33153. {
  33154. $this->input = $input;
  33155. }
  33156. }
  33157. <?php
  33158. namespace Symfony\Component\Console\Helper;
  33159. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33160. use Symfony\Component\Console\Output\OutputInterface;
  33161. use Symfony\Component\Process\Exception\ProcessFailedException;
  33162. use Symfony\Component\Process\Process;
  33163. use Symfony\Component\Process\ProcessBuilder;
  33164. class ProcessHelper extends Helper
  33165. {
  33166. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  33167. {
  33168. if ($output instanceof ConsoleOutputInterface) {
  33169. $output = $output->getErrorOutput();
  33170. }
  33171. $formatter = $this->getHelperSet()->get('debug_formatter');
  33172. if (is_array($cmd)) {
  33173. $process = ProcessBuilder::create($cmd)->getProcess();
  33174. } elseif ($cmd instanceof Process) {
  33175. $process = $cmd;
  33176. } else {
  33177. $process = new Process($cmd);
  33178. }
  33179. if ($verbosity <= $output->getVerbosity()) {
  33180. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  33181. }
  33182. if ($output->isDebug()) {
  33183. $callback = $this->wrapCallback($output, $process, $callback);
  33184. }
  33185. $process->run($callback);
  33186. if ($verbosity <= $output->getVerbosity()) {
  33187. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  33188. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  33189. }
  33190. if (!$process->isSuccessful() && null !== $error) {
  33191. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  33192. }
  33193. return $process;
  33194. }
  33195. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  33196. {
  33197. $process = $this->run($output, $cmd, $error, $callback);
  33198. if (!$process->isSuccessful()) {
  33199. throw new ProcessFailedException($process);
  33200. }
  33201. return $process;
  33202. }
  33203. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  33204. {
  33205. if ($output instanceof ConsoleOutputInterface) {
  33206. $output = $output->getErrorOutput();
  33207. }
  33208. $formatter = $this->getHelperSet()->get('debug_formatter');
  33209. $that = $this;
  33210. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  33211. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  33212. if (null !== $callback) {
  33213. call_user_func($callback, $type, $buffer);
  33214. }
  33215. };
  33216. }
  33217. public function escapeString($str)
  33218. {
  33219. return str_replace('<', '\\<', $str);
  33220. }
  33221. public function getName()
  33222. {
  33223. return 'process';
  33224. }
  33225. }
  33226. <?php
  33227. namespace Symfony\Component\Console\Helper;
  33228. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33229. use Symfony\Component\Console\Output\OutputInterface;
  33230. use Symfony\Component\Console\Exception\LogicException;
  33231. class ProgressBar
  33232. {
  33233. private $barWidth = 28;
  33234. private $barChar;
  33235. private $emptyBarChar = '-';
  33236. private $progressChar = '>';
  33237. private $format;
  33238. private $internalFormat;
  33239. private $redrawFreq = 1;
  33240. private $output;
  33241. private $step = 0;
  33242. private $max;
  33243. private $startTime;
  33244. private $stepWidth;
  33245. private $percent = 0.0;
  33246. private $formatLineCount;
  33247. private $messages = array();
  33248. private $overwrite = true;
  33249. private $firstRun = true;
  33250. private static $formatters;
  33251. private static $formats;
  33252. public function __construct(OutputInterface $output, $max = 0)
  33253. {
  33254. if ($output instanceof ConsoleOutputInterface) {
  33255. $output = $output->getErrorOutput();
  33256. }
  33257. $this->output = $output;
  33258. $this->setMaxSteps($max);
  33259. if (!$this->output->isDecorated()) {
  33260. $this->overwrite = false;
  33261. $this->setRedrawFrequency($max / 10);
  33262. }
  33263. $this->startTime = time();
  33264. }
  33265. public static function setPlaceholderFormatterDefinition($name, $callable)
  33266. {
  33267. if (!self::$formatters) {
  33268. self::$formatters = self::initPlaceholderFormatters();
  33269. }
  33270. self::$formatters[$name] = $callable;
  33271. }
  33272. public static function getPlaceholderFormatterDefinition($name)
  33273. {
  33274. if (!self::$formatters) {
  33275. self::$formatters = self::initPlaceholderFormatters();
  33276. }
  33277. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  33278. }
  33279. public static function setFormatDefinition($name, $format)
  33280. {
  33281. if (!self::$formats) {
  33282. self::$formats = self::initFormats();
  33283. }
  33284. self::$formats[$name] = $format;
  33285. }
  33286. public static function getFormatDefinition($name)
  33287. {
  33288. if (!self::$formats) {
  33289. self::$formats = self::initFormats();
  33290. }
  33291. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  33292. }
  33293. public function setMessage($message, $name = 'message')
  33294. {
  33295. $this->messages[$name] = $message;
  33296. }
  33297. public function getMessage($name = 'message')
  33298. {
  33299. return $this->messages[$name];
  33300. }
  33301. public function getStartTime()
  33302. {
  33303. return $this->startTime;
  33304. }
  33305. public function getMaxSteps()
  33306. {
  33307. return $this->max;
  33308. }
  33309. public function getStep()
  33310. {
  33311. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  33312. return $this->getProgress();
  33313. }
  33314. public function getProgress()
  33315. {
  33316. return $this->step;
  33317. }
  33318. public function getStepWidth()
  33319. {
  33320. return $this->stepWidth;
  33321. }
  33322. public function getProgressPercent()
  33323. {
  33324. return $this->percent;
  33325. }
  33326. public function setBarWidth($size)
  33327. {
  33328. $this->barWidth = (int) $size;
  33329. }
  33330. public function getBarWidth()
  33331. {
  33332. return $this->barWidth;
  33333. }
  33334. public function setBarCharacter($char)
  33335. {
  33336. $this->barChar = $char;
  33337. }
  33338. public function getBarCharacter()
  33339. {
  33340. if (null === $this->barChar) {
  33341. return $this->max ? '=' : $this->emptyBarChar;
  33342. }
  33343. return $this->barChar;
  33344. }
  33345. public function setEmptyBarCharacter($char)
  33346. {
  33347. $this->emptyBarChar = $char;
  33348. }
  33349. public function getEmptyBarCharacter()
  33350. {
  33351. return $this->emptyBarChar;
  33352. }
  33353. public function setProgressCharacter($char)
  33354. {
  33355. $this->progressChar = $char;
  33356. }
  33357. public function getProgressCharacter()
  33358. {
  33359. return $this->progressChar;
  33360. }
  33361. public function setFormat($format)
  33362. {
  33363. $this->format = null;
  33364. $this->internalFormat = $format;
  33365. }
  33366. public function setRedrawFrequency($freq)
  33367. {
  33368. $this->redrawFreq = max((int) $freq, 1);
  33369. }
  33370. public function start($max = null)
  33371. {
  33372. $this->startTime = time();
  33373. $this->step = 0;
  33374. $this->percent = 0.0;
  33375. if (null !== $max) {
  33376. $this->setMaxSteps($max);
  33377. }
  33378. $this->display();
  33379. }
  33380. public function advance($step = 1)
  33381. {
  33382. $this->setProgress($this->step + $step);
  33383. }
  33384. public function setCurrent($step)
  33385. {
  33386. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  33387. $this->setProgress($step);
  33388. }
  33389. public function setOverwrite($overwrite)
  33390. {
  33391. $this->overwrite = (bool) $overwrite;
  33392. }
  33393. public function setProgress($step)
  33394. {
  33395. $step = (int) $step;
  33396. if ($step < $this->step) {
  33397. throw new LogicException('You can\'t regress the progress bar.');
  33398. }
  33399. if ($this->max && $step > $this->max) {
  33400. $this->max = $step;
  33401. }
  33402. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  33403. $currPeriod = (int) ($step / $this->redrawFreq);
  33404. $this->step = $step;
  33405. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  33406. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  33407. $this->display();
  33408. }
  33409. }
  33410. public function finish()
  33411. {
  33412. if (!$this->max) {
  33413. $this->max = $this->step;
  33414. }
  33415. if ($this->step === $this->max && !$this->overwrite) {
  33416. return;
  33417. }
  33418. $this->setProgress($this->max);
  33419. }
  33420. public function display()
  33421. {
  33422. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  33423. return;
  33424. }
  33425. if (null === $this->format) {
  33426. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  33427. }
  33428. $self = $this;
  33429. $output = $this->output;
  33430. $messages = $this->messages;
  33431. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  33432. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  33433. $text = call_user_func($formatter, $self, $output);
  33434. } elseif (isset($messages[$matches[1]])) {
  33435. $text = $messages[$matches[1]];
  33436. } else {
  33437. return $matches[0];
  33438. }
  33439. if (isset($matches[2])) {
  33440. $text = sprintf('%'.$matches[2], $text);
  33441. }
  33442. return $text;
  33443. }, $this->format));
  33444. }
  33445. public function clear()
  33446. {
  33447. if (!$this->overwrite) {
  33448. return;
  33449. }
  33450. if (null === $this->format) {
  33451. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  33452. }
  33453. $this->overwrite('');
  33454. }
  33455. private function setRealFormat($format)
  33456. {
  33457. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  33458. $this->format = self::getFormatDefinition($format.'_nomax');
  33459. } elseif (null !== self::getFormatDefinition($format)) {
  33460. $this->format = self::getFormatDefinition($format);
  33461. } else {
  33462. $this->format = $format;
  33463. }
  33464. $this->formatLineCount = substr_count($this->format, "\n");
  33465. }
  33466. private function setMaxSteps($max)
  33467. {
  33468. $this->max = max(0, (int) $max);
  33469. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  33470. }
  33471. private function overwrite($message)
  33472. {
  33473. if ($this->overwrite) {
  33474. if (!$this->firstRun) {
  33475. $this->output->write("\x0D");
  33476. $this->output->write("\x1B[2K");
  33477. if ($this->formatLineCount > 0) {
  33478. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  33479. }
  33480. }
  33481. } elseif ($this->step > 0) {
  33482. $this->output->writeln('');
  33483. }
  33484. $this->firstRun = false;
  33485. $this->output->write($message);
  33486. }
  33487. private function determineBestFormat()
  33488. {
  33489. switch ($this->output->getVerbosity()) {
  33490. case OutputInterface::VERBOSITY_VERBOSE:
  33491. return $this->max ? 'verbose' : 'verbose_nomax';
  33492. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  33493. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  33494. case OutputInterface::VERBOSITY_DEBUG:
  33495. return $this->max ? 'debug' : 'debug_nomax';
  33496. default:
  33497. return $this->max ? 'normal' : 'normal_nomax';
  33498. }
  33499. }
  33500. private static function initPlaceholderFormatters()
  33501. {
  33502. return array(
  33503. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  33504. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  33505. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  33506. if ($completeBars < $bar->getBarWidth()) {
  33507. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  33508. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  33509. }
  33510. return $display;
  33511. },
  33512. 'elapsed' => function (ProgressBar $bar) {
  33513. return Helper::formatTime(time() - $bar->getStartTime());
  33514. },
  33515. 'remaining' => function (ProgressBar $bar) {
  33516. if (!$bar->getMaxSteps()) {
  33517. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  33518. }
  33519. if (!$bar->getProgress()) {
  33520. $remaining = 0;
  33521. } else {
  33522. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  33523. }
  33524. return Helper::formatTime($remaining);
  33525. },
  33526. 'estimated' => function (ProgressBar $bar) {
  33527. if (!$bar->getMaxSteps()) {
  33528. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  33529. }
  33530. if (!$bar->getProgress()) {
  33531. $estimated = 0;
  33532. } else {
  33533. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  33534. }
  33535. return Helper::formatTime($estimated);
  33536. },
  33537. 'memory' => function (ProgressBar $bar) {
  33538. return Helper::formatMemory(memory_get_usage(true));
  33539. },
  33540. 'current' => function (ProgressBar $bar) {
  33541. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  33542. },
  33543. 'max' => function (ProgressBar $bar) {
  33544. return $bar->getMaxSteps();
  33545. },
  33546. 'percent' => function (ProgressBar $bar) {
  33547. return floor($bar->getProgressPercent() * 100);
  33548. },
  33549. );
  33550. }
  33551. private static function initFormats()
  33552. {
  33553. return array(
  33554. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  33555. 'normal_nomax' => ' %current% [%bar%]',
  33556. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  33557. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  33558. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  33559. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  33560. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  33561. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  33562. );
  33563. }
  33564. }
  33565. <?php
  33566. namespace Symfony\Component\Console\Helper;
  33567. use Symfony\Component\Console\Output\NullOutput;
  33568. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33569. use Symfony\Component\Console\Output\OutputInterface;
  33570. use Symfony\Component\Console\Exception\LogicException;
  33571. class ProgressHelper extends Helper
  33572. {
  33573. const FORMAT_QUIET = ' %percent%%';
  33574. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  33575. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  33576. const FORMAT_QUIET_NOMAX = ' %current%';
  33577. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  33578. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  33579. private $barWidth = 28;
  33580. private $barChar = '=';
  33581. private $emptyBarChar = '-';
  33582. private $progressChar = '>';
  33583. private $format = null;
  33584. private $redrawFreq = 1;
  33585. private $lastMessagesLength;
  33586. private $barCharOriginal;
  33587. private $output;
  33588. private $current;
  33589. private $max;
  33590. private $startTime;
  33591. private $defaultFormatVars = array(
  33592. 'current',
  33593. 'max',
  33594. 'bar',
  33595. 'percent',
  33596. 'elapsed',
  33597. );
  33598. private $formatVars;
  33599. private $widths = array(
  33600. 'current' => 4,
  33601. 'max' => 4,
  33602. 'percent' => 3,
  33603. 'elapsed' => 6,
  33604. );
  33605. private $timeFormats = array(
  33606. array(0, '???'),
  33607. array(2, '1 sec'),
  33608. array(59, 'secs', 1),
  33609. array(60, '1 min'),
  33610. array(3600, 'mins', 60),
  33611. array(5400, '1 hr'),
  33612. array(86400, 'hrs', 3600),
  33613. array(129600, '1 day'),
  33614. array(604800, 'days', 86400),
  33615. );
  33616. public function __construct($triggerDeprecationError = true)
  33617. {
  33618. if ($triggerDeprecationError) {
  33619. @trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  33620. }
  33621. }
  33622. public function setBarWidth($size)
  33623. {
  33624. $this->barWidth = (int) $size;
  33625. }
  33626. public function setBarCharacter($char)
  33627. {
  33628. $this->barChar = $char;
  33629. }
  33630. public function setEmptyBarCharacter($char)
  33631. {
  33632. $this->emptyBarChar = $char;
  33633. }
  33634. public function setProgressCharacter($char)
  33635. {
  33636. $this->progressChar = $char;
  33637. }
  33638. public function setFormat($format)
  33639. {
  33640. $this->format = $format;
  33641. }
  33642. public function setRedrawFrequency($freq)
  33643. {
  33644. $this->redrawFreq = (int) $freq;
  33645. }
  33646. public function start(OutputInterface $output, $max = null)
  33647. {
  33648. if ($output instanceof ConsoleOutputInterface) {
  33649. $output = $output->getErrorOutput();
  33650. }
  33651. $this->startTime = time();
  33652. $this->current = 0;
  33653. $this->max = (int) $max;
  33654. $this->output = $output->isDecorated() ? $output : new NullOutput();
  33655. $this->lastMessagesLength = 0;
  33656. $this->barCharOriginal = '';
  33657. if (null === $this->format) {
  33658. switch ($output->getVerbosity()) {
  33659. case OutputInterface::VERBOSITY_QUIET:
  33660. $this->format = self::FORMAT_QUIET_NOMAX;
  33661. if ($this->max > 0) {
  33662. $this->format = self::FORMAT_QUIET;
  33663. }
  33664. break;
  33665. case OutputInterface::VERBOSITY_VERBOSE:
  33666. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  33667. case OutputInterface::VERBOSITY_DEBUG:
  33668. $this->format = self::FORMAT_VERBOSE_NOMAX;
  33669. if ($this->max > 0) {
  33670. $this->format = self::FORMAT_VERBOSE;
  33671. }
  33672. break;
  33673. default:
  33674. $this->format = self::FORMAT_NORMAL_NOMAX;
  33675. if ($this->max > 0) {
  33676. $this->format = self::FORMAT_NORMAL;
  33677. }
  33678. break;
  33679. }
  33680. }
  33681. $this->initialize();
  33682. }
  33683. public function advance($step = 1, $redraw = false)
  33684. {
  33685. $this->setCurrent($this->current + $step, $redraw);
  33686. }
  33687. public function setCurrent($current, $redraw = false)
  33688. {
  33689. if (null === $this->startTime) {
  33690. throw new LogicException('You must start the progress bar before calling setCurrent().');
  33691. }
  33692. $current = (int) $current;
  33693. if ($current < $this->current) {
  33694. throw new LogicException('You can\'t regress the progress bar');
  33695. }
  33696. if (0 === $this->current) {
  33697. $redraw = true;
  33698. }
  33699. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  33700. $this->current = $current;
  33701. $currPeriod = (int) ($this->current / $this->redrawFreq);
  33702. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  33703. $this->display();
  33704. }
  33705. }
  33706. public function display($finish = false)
  33707. {
  33708. if (null === $this->startTime) {
  33709. throw new LogicException('You must start the progress bar before calling display().');
  33710. }
  33711. $message = $this->format;
  33712. foreach ($this->generate($finish) as $name => $value) {
  33713. $message = str_replace("%{$name}%", $value, $message);
  33714. }
  33715. $this->overwrite($this->output, $message);
  33716. }
  33717. public function clear()
  33718. {
  33719. $this->overwrite($this->output, '');
  33720. }
  33721. public function finish()
  33722. {
  33723. if (null === $this->startTime) {
  33724. throw new LogicException('You must start the progress bar before calling finish().');
  33725. }
  33726. if (null !== $this->startTime) {
  33727. if (!$this->max) {
  33728. $this->barChar = $this->barCharOriginal;
  33729. $this->display(true);
  33730. }
  33731. $this->startTime = null;
  33732. $this->output->writeln('');
  33733. $this->output = null;
  33734. }
  33735. }
  33736. private function initialize()
  33737. {
  33738. $this->formatVars = array();
  33739. foreach ($this->defaultFormatVars as $var) {
  33740. if (false !== strpos($this->format, "%{$var}%")) {
  33741. $this->formatVars[$var] = true;
  33742. }
  33743. }
  33744. if ($this->max > 0) {
  33745. $this->widths['max'] = $this->strlen($this->max);
  33746. $this->widths['current'] = $this->widths['max'];
  33747. } else {
  33748. $this->barCharOriginal = $this->barChar;
  33749. $this->barChar = $this->emptyBarChar;
  33750. }
  33751. }
  33752. private function generate($finish = false)
  33753. {
  33754. $vars = array();
  33755. $percent = 0;
  33756. if ($this->max > 0) {
  33757. $percent = (float) $this->current / $this->max;
  33758. }
  33759. if (isset($this->formatVars['bar'])) {
  33760. if ($this->max > 0) {
  33761. $completeBars = floor($percent * $this->barWidth);
  33762. } else {
  33763. if (!$finish) {
  33764. $completeBars = floor($this->current % $this->barWidth);
  33765. } else {
  33766. $completeBars = $this->barWidth;
  33767. }
  33768. }
  33769. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  33770. $bar = str_repeat($this->barChar, $completeBars);
  33771. if ($completeBars < $this->barWidth) {
  33772. $bar .= $this->progressChar;
  33773. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  33774. }
  33775. $vars['bar'] = $bar;
  33776. }
  33777. if (isset($this->formatVars['elapsed'])) {
  33778. $elapsed = time() - $this->startTime;
  33779. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  33780. }
  33781. if (isset($this->formatVars['current'])) {
  33782. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  33783. }
  33784. if (isset($this->formatVars['max'])) {
  33785. $vars['max'] = $this->max;
  33786. }
  33787. if (isset($this->formatVars['percent'])) {
  33788. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  33789. }
  33790. return $vars;
  33791. }
  33792. private function humaneTime($secs)
  33793. {
  33794. $text = '';
  33795. foreach ($this->timeFormats as $format) {
  33796. if ($secs < $format[0]) {
  33797. if (2 == count($format)) {
  33798. $text = $format[1];
  33799. break;
  33800. } else {
  33801. $text = ceil($secs / $format[2]).' '.$format[1];
  33802. break;
  33803. }
  33804. }
  33805. }
  33806. return $text;
  33807. }
  33808. private function overwrite(OutputInterface $output, $message)
  33809. {
  33810. $length = $this->strlen($message);
  33811. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  33812. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  33813. }
  33814. $output->write("\x0D");
  33815. $output->write($message);
  33816. $this->lastMessagesLength = $this->strlen($message);
  33817. }
  33818. public function getName()
  33819. {
  33820. return 'progress';
  33821. }
  33822. }
  33823. <?php
  33824. namespace Symfony\Component\Console\Helper;
  33825. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33826. use Symfony\Component\Console\Exception\LogicException;
  33827. use Symfony\Component\Console\Output\OutputInterface;
  33828. class ProgressIndicator
  33829. {
  33830. private $output;
  33831. private $startTime;
  33832. private $format;
  33833. private $message;
  33834. private $indicatorValues;
  33835. private $indicatorCurrent;
  33836. private $indicatorChangeInterval;
  33837. private $indicatorUpdateTime;
  33838. private $started = false;
  33839. private static $formatters;
  33840. private static $formats;
  33841. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  33842. {
  33843. $this->output = $output;
  33844. if (null === $format) {
  33845. $format = $this->determineBestFormat();
  33846. }
  33847. if (null === $indicatorValues) {
  33848. $indicatorValues = array('-', '\\', '|', '/');
  33849. }
  33850. $indicatorValues = array_values($indicatorValues);
  33851. if (2 > count($indicatorValues)) {
  33852. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  33853. }
  33854. $this->format = self::getFormatDefinition($format);
  33855. $this->indicatorChangeInterval = $indicatorChangeInterval;
  33856. $this->indicatorValues = $indicatorValues;
  33857. $this->startTime = time();
  33858. }
  33859. public function setMessage($message)
  33860. {
  33861. $this->message = $message;
  33862. $this->display();
  33863. }
  33864. public function getMessage()
  33865. {
  33866. return $this->message;
  33867. }
  33868. public function getStartTime()
  33869. {
  33870. return $this->startTime;
  33871. }
  33872. public function getCurrentValue()
  33873. {
  33874. return $this->indicatorValues[$this->indicatorCurrent % count($this->indicatorValues)];
  33875. }
  33876. public function start($message)
  33877. {
  33878. if ($this->started) {
  33879. throw new LogicException('Progress indicator already started.');
  33880. }
  33881. $this->message = $message;
  33882. $this->started = true;
  33883. $this->startTime = time();
  33884. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  33885. $this->indicatorCurrent = 0;
  33886. $this->display();
  33887. }
  33888. public function advance()
  33889. {
  33890. if (!$this->started) {
  33891. throw new LogicException('Progress indicator has not yet been started.');
  33892. }
  33893. if (!$this->output->isDecorated()) {
  33894. return;
  33895. }
  33896. $currentTime = $this->getCurrentTimeInMilliseconds();
  33897. if ($currentTime < $this->indicatorUpdateTime) {
  33898. return;
  33899. }
  33900. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  33901. ++$this->indicatorCurrent;
  33902. $this->display();
  33903. }
  33904. public function finish($message)
  33905. {
  33906. if (!$this->started) {
  33907. throw new LogicException('Progress indicator has not yet been started.');
  33908. }
  33909. $this->message = $message;
  33910. $this->display();
  33911. $this->output->writeln('');
  33912. $this->started = false;
  33913. }
  33914. public static function getFormatDefinition($name)
  33915. {
  33916. if (!self::$formats) {
  33917. self::$formats = self::initFormats();
  33918. }
  33919. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  33920. }
  33921. public static function setPlaceholderFormatterDefinition($name, $callable)
  33922. {
  33923. if (!self::$formatters) {
  33924. self::$formatters = self::initPlaceholderFormatters();
  33925. }
  33926. self::$formatters[$name] = $callable;
  33927. }
  33928. public static function getPlaceholderFormatterDefinition($name)
  33929. {
  33930. if (!self::$formatters) {
  33931. self::$formatters = self::initPlaceholderFormatters();
  33932. }
  33933. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  33934. }
  33935. private function display()
  33936. {
  33937. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  33938. return;
  33939. }
  33940. $self = $this;
  33941. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  33942. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  33943. return call_user_func($formatter, $self);
  33944. }
  33945. return $matches[0];
  33946. }, $this->format));
  33947. }
  33948. private function determineBestFormat()
  33949. {
  33950. switch ($this->output->getVerbosity()) {
  33951. case OutputInterface::VERBOSITY_VERBOSE:
  33952. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  33953. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  33954. case OutputInterface::VERBOSITY_DEBUG:
  33955. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  33956. default:
  33957. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  33958. }
  33959. }
  33960. private function overwrite($message)
  33961. {
  33962. if ($this->output->isDecorated()) {
  33963. $this->output->write("\x0D\x1B[2K");
  33964. $this->output->write($message);
  33965. } else {
  33966. $this->output->writeln($message);
  33967. }
  33968. }
  33969. private function getCurrentTimeInMilliseconds()
  33970. {
  33971. return round(microtime(true) * 1000);
  33972. }
  33973. private static function initPlaceholderFormatters()
  33974. {
  33975. return array(
  33976. 'indicator' => function (ProgressIndicator $indicator) {
  33977. return $indicator->getCurrentValue();
  33978. },
  33979. 'message' => function (ProgressIndicator $indicator) {
  33980. return $indicator->getMessage();
  33981. },
  33982. 'elapsed' => function (ProgressIndicator $indicator) {
  33983. return Helper::formatTime(time() - $indicator->getStartTime());
  33984. },
  33985. 'memory' => function () {
  33986. return Helper::formatMemory(memory_get_usage(true));
  33987. },
  33988. );
  33989. }
  33990. private static function initFormats()
  33991. {
  33992. return array(
  33993. 'normal' => ' %indicator% %message%',
  33994. 'normal_no_ansi' => ' %message%',
  33995. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  33996. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  33997. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  33998. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  33999. );
  34000. }
  34001. }
  34002. <?php
  34003. namespace Symfony\Component\Console\Helper;
  34004. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34005. use Symfony\Component\Console\Exception\RuntimeException;
  34006. use Symfony\Component\Console\Formatter\OutputFormatter;
  34007. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  34008. use Symfony\Component\Console\Input\InputInterface;
  34009. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34010. use Symfony\Component\Console\Output\OutputInterface;
  34011. use Symfony\Component\Console\Question\Question;
  34012. use Symfony\Component\Console\Question\ChoiceQuestion;
  34013. class QuestionHelper extends Helper
  34014. {
  34015. private $inputStream;
  34016. private static $shell;
  34017. private static $stty;
  34018. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  34019. {
  34020. if ($output instanceof ConsoleOutputInterface) {
  34021. $output = $output->getErrorOutput();
  34022. }
  34023. if (!$input->isInteractive()) {
  34024. return $question->getDefault();
  34025. }
  34026. if (!$question->getValidator()) {
  34027. return $this->doAsk($output, $question);
  34028. }
  34029. $that = $this;
  34030. $interviewer = function () use ($output, $question, $that) {
  34031. return $that->doAsk($output, $question);
  34032. };
  34033. return $this->validateAttempts($interviewer, $output, $question);
  34034. }
  34035. public function setInputStream($stream)
  34036. {
  34037. if (!is_resource($stream)) {
  34038. throw new InvalidArgumentException('Input stream must be a valid resource.');
  34039. }
  34040. $this->inputStream = $stream;
  34041. }
  34042. public function getInputStream()
  34043. {
  34044. return $this->inputStream;
  34045. }
  34046. public function getName()
  34047. {
  34048. return 'question';
  34049. }
  34050. public function doAsk(OutputInterface $output, Question $question)
  34051. {
  34052. $this->writePrompt($output, $question);
  34053. $inputStream = $this->inputStream ?: STDIN;
  34054. $autocomplete = $question->getAutocompleterValues();
  34055. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  34056. $ret = false;
  34057. if ($question->isHidden()) {
  34058. try {
  34059. $ret = trim($this->getHiddenResponse($output, $inputStream));
  34060. } catch (RuntimeException $e) {
  34061. if (!$question->isHiddenFallback()) {
  34062. throw $e;
  34063. }
  34064. }
  34065. }
  34066. if (false === $ret) {
  34067. $ret = fgets($inputStream, 4096);
  34068. if (false === $ret) {
  34069. throw new RuntimeException('Aborted');
  34070. }
  34071. $ret = trim($ret);
  34072. }
  34073. } else {
  34074. $ret = trim($this->autocomplete($output, $question, $inputStream, is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  34075. }
  34076. $ret = strlen($ret) > 0 ? $ret : $question->getDefault();
  34077. if ($normalizer = $question->getNormalizer()) {
  34078. return $normalizer($ret);
  34079. }
  34080. return $ret;
  34081. }
  34082. protected function writePrompt(OutputInterface $output, Question $question)
  34083. {
  34084. $message = $question->getQuestion();
  34085. if ($question instanceof ChoiceQuestion) {
  34086. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  34087. $messages = (array) $question->getQuestion();
  34088. foreach ($question->getChoices() as $key => $value) {
  34089. $width = $maxWidth - $this->strlen($key);
  34090. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  34091. }
  34092. $output->writeln($messages);
  34093. $message = $question->getPrompt();
  34094. }
  34095. $output->write($message);
  34096. }
  34097. protected function writeError(OutputInterface $output, \Exception $error)
  34098. {
  34099. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  34100. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  34101. } else {
  34102. $message = '<error>'.$error->getMessage().'</error>';
  34103. }
  34104. $output->writeln($message);
  34105. }
  34106. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  34107. {
  34108. $ret = '';
  34109. $i = 0;
  34110. $ofs = -1;
  34111. $matches = $autocomplete;
  34112. $numMatches = count($matches);
  34113. $sttyMode = shell_exec('stty -g');
  34114. shell_exec('stty -icanon -echo');
  34115. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  34116. while (!feof($inputStream)) {
  34117. $c = fread($inputStream, 1);
  34118. if ("\177" === $c) {
  34119. if (0 === $numMatches && 0 !== $i) {
  34120. --$i;
  34121. $output->write("\033[1D");
  34122. }
  34123. if (0 === $i) {
  34124. $ofs = -1;
  34125. $matches = $autocomplete;
  34126. $numMatches = count($matches);
  34127. } else {
  34128. $numMatches = 0;
  34129. }
  34130. $ret = substr($ret, 0, $i);
  34131. } elseif ("\033" === $c) {
  34132. $c .= fread($inputStream, 2);
  34133. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  34134. if ('A' === $c[2] && -1 === $ofs) {
  34135. $ofs = 0;
  34136. }
  34137. if (0 === $numMatches) {
  34138. continue;
  34139. }
  34140. $ofs += ('A' === $c[2]) ? -1 : 1;
  34141. $ofs = ($numMatches + $ofs) % $numMatches;
  34142. }
  34143. } elseif (ord($c) < 32) {
  34144. if ("\t" === $c || "\n" === $c) {
  34145. if ($numMatches > 0 && -1 !== $ofs) {
  34146. $ret = $matches[$ofs];
  34147. $output->write(substr($ret, $i));
  34148. $i = strlen($ret);
  34149. }
  34150. if ("\n" === $c) {
  34151. $output->write($c);
  34152. break;
  34153. }
  34154. $numMatches = 0;
  34155. }
  34156. continue;
  34157. } else {
  34158. $output->write($c);
  34159. $ret .= $c;
  34160. ++$i;
  34161. $numMatches = 0;
  34162. $ofs = 0;
  34163. foreach ($autocomplete as $value) {
  34164. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  34165. $matches[$numMatches++] = $value;
  34166. }
  34167. }
  34168. }
  34169. $output->write("\033[K");
  34170. if ($numMatches > 0 && -1 !== $ofs) {
  34171. $output->write("\0337");
  34172. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  34173. $output->write("\0338");
  34174. }
  34175. }
  34176. shell_exec(sprintf('stty %s', $sttyMode));
  34177. return $ret;
  34178. }
  34179. private function getHiddenResponse(OutputInterface $output, $inputStream)
  34180. {
  34181. if ('\\' === DIRECTORY_SEPARATOR) {
  34182. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  34183. if ('phar:' === substr(__FILE__, 0, 5)) {
  34184. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  34185. copy($exe, $tmpExe);
  34186. $exe = $tmpExe;
  34187. }
  34188. $value = rtrim(shell_exec($exe));
  34189. $output->writeln('');
  34190. if (isset($tmpExe)) {
  34191. unlink($tmpExe);
  34192. }
  34193. return $value;
  34194. }
  34195. if ($this->hasSttyAvailable()) {
  34196. $sttyMode = shell_exec('stty -g');
  34197. shell_exec('stty -echo');
  34198. $value = fgets($inputStream, 4096);
  34199. shell_exec(sprintf('stty %s', $sttyMode));
  34200. if (false === $value) {
  34201. throw new RuntimeException('Aborted');
  34202. }
  34203. $value = trim($value);
  34204. $output->writeln('');
  34205. return $value;
  34206. }
  34207. if (false !== $shell = $this->getShell()) {
  34208. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  34209. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  34210. $value = rtrim(shell_exec($command));
  34211. $output->writeln('');
  34212. return $value;
  34213. }
  34214. throw new RuntimeException('Unable to hide the response.');
  34215. }
  34216. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  34217. {
  34218. $error = null;
  34219. $attempts = $question->getMaxAttempts();
  34220. while (null === $attempts || $attempts--) {
  34221. if (null !== $error) {
  34222. $this->writeError($output, $error);
  34223. }
  34224. try {
  34225. return call_user_func($question->getValidator(), $interviewer());
  34226. } catch (RuntimeException $e) {
  34227. throw $e;
  34228. } catch (\Exception $error) {
  34229. }
  34230. }
  34231. throw $error;
  34232. }
  34233. private function getShell()
  34234. {
  34235. if (null !== self::$shell) {
  34236. return self::$shell;
  34237. }
  34238. self::$shell = false;
  34239. if (file_exists('/usr/bin/env')) {
  34240. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  34241. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  34242. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  34243. self::$shell = $sh;
  34244. break;
  34245. }
  34246. }
  34247. }
  34248. return self::$shell;
  34249. }
  34250. private function hasSttyAvailable()
  34251. {
  34252. if (null !== self::$stty) {
  34253. return self::$stty;
  34254. }
  34255. exec('stty 2>&1', $output, $exitcode);
  34256. return self::$stty = 0 === $exitcode;
  34257. }
  34258. }
  34259. <?php
  34260. namespace Symfony\Component\Console\Helper;
  34261. use Symfony\Component\Console\Exception\LogicException;
  34262. use Symfony\Component\Console\Input\InputInterface;
  34263. use Symfony\Component\Console\Output\OutputInterface;
  34264. use Symfony\Component\Console\Question\ChoiceQuestion;
  34265. use Symfony\Component\Console\Question\ConfirmationQuestion;
  34266. use Symfony\Component\Console\Question\Question;
  34267. use Symfony\Component\Console\Style\SymfonyStyle;
  34268. use Symfony\Component\Console\Formatter\OutputFormatter;
  34269. class SymfonyQuestionHelper extends QuestionHelper
  34270. {
  34271. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  34272. {
  34273. $validator = $question->getValidator();
  34274. $question->setValidator(function ($value) use ($validator) {
  34275. if (null !== $validator) {
  34276. $value = $validator($value);
  34277. } else {
  34278. if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
  34279. throw new LogicException('A value is required.');
  34280. }
  34281. }
  34282. return $value;
  34283. });
  34284. return parent::ask($input, $output, $question);
  34285. }
  34286. protected function writePrompt(OutputInterface $output, Question $question)
  34287. {
  34288. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  34289. $default = $question->getDefault();
  34290. switch (true) {
  34291. case null === $default:
  34292. $text = sprintf(' <info>%s</info>:', $text);
  34293. break;
  34294. case $question instanceof ConfirmationQuestion:
  34295. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  34296. break;
  34297. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  34298. $choices = $question->getChoices();
  34299. $default = explode(',', $default);
  34300. foreach ($default as $key => $value) {
  34301. $default[$key] = $choices[trim($value)];
  34302. }
  34303. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  34304. break;
  34305. case $question instanceof ChoiceQuestion:
  34306. $choices = $question->getChoices();
  34307. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default]));
  34308. break;
  34309. default:
  34310. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  34311. }
  34312. $output->writeln($text);
  34313. if ($question instanceof ChoiceQuestion) {
  34314. $width = max(array_map('strlen', array_keys($question->getChoices())));
  34315. foreach ($question->getChoices() as $key => $value) {
  34316. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  34317. }
  34318. }
  34319. $output->write(' > ');
  34320. }
  34321. protected function writeError(OutputInterface $output, \Exception $error)
  34322. {
  34323. if ($output instanceof SymfonyStyle) {
  34324. $output->newLine();
  34325. $output->error($error->getMessage());
  34326. return;
  34327. }
  34328. parent::writeError($output, $error);
  34329. }
  34330. }
  34331. <?php
  34332. namespace Symfony\Component\Console\Helper;
  34333. use Symfony\Component\Console\Output\OutputInterface;
  34334. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34335. class Table
  34336. {
  34337. private $headers = array();
  34338. private $rows = array();
  34339. private $columnWidths = array();
  34340. private $numberOfColumns;
  34341. private $output;
  34342. private $style;
  34343. private $columnStyles = array();
  34344. private static $styles;
  34345. public function __construct(OutputInterface $output)
  34346. {
  34347. $this->output = $output;
  34348. if (!self::$styles) {
  34349. self::$styles = self::initStyles();
  34350. }
  34351. $this->setStyle('default');
  34352. }
  34353. public static function setStyleDefinition($name, TableStyle $style)
  34354. {
  34355. if (!self::$styles) {
  34356. self::$styles = self::initStyles();
  34357. }
  34358. self::$styles[$name] = $style;
  34359. }
  34360. public static function getStyleDefinition($name)
  34361. {
  34362. if (!self::$styles) {
  34363. self::$styles = self::initStyles();
  34364. }
  34365. if (isset(self::$styles[$name])) {
  34366. return self::$styles[$name];
  34367. }
  34368. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  34369. }
  34370. public function setStyle($name)
  34371. {
  34372. $this->style = $this->resolveStyle($name);
  34373. return $this;
  34374. }
  34375. public function getStyle()
  34376. {
  34377. return $this->style;
  34378. }
  34379. public function setColumnStyle($columnIndex, $name)
  34380. {
  34381. $columnIndex = (int) $columnIndex;
  34382. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  34383. return $this;
  34384. }
  34385. public function getColumnStyle($columnIndex)
  34386. {
  34387. if (isset($this->columnStyles[$columnIndex])) {
  34388. return $this->columnStyles[$columnIndex];
  34389. }
  34390. return $this->getStyle();
  34391. }
  34392. public function setHeaders(array $headers)
  34393. {
  34394. $headers = array_values($headers);
  34395. if (!empty($headers) && !is_array($headers[0])) {
  34396. $headers = array($headers);
  34397. }
  34398. $this->headers = $headers;
  34399. return $this;
  34400. }
  34401. public function setRows(array $rows)
  34402. {
  34403. $this->rows = array();
  34404. return $this->addRows($rows);
  34405. }
  34406. public function addRows(array $rows)
  34407. {
  34408. foreach ($rows as $row) {
  34409. $this->addRow($row);
  34410. }
  34411. return $this;
  34412. }
  34413. public function addRow($row)
  34414. {
  34415. if ($row instanceof TableSeparator) {
  34416. $this->rows[] = $row;
  34417. return $this;
  34418. }
  34419. if (!is_array($row)) {
  34420. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  34421. }
  34422. $this->rows[] = array_values($row);
  34423. return $this;
  34424. }
  34425. public function setRow($column, array $row)
  34426. {
  34427. $this->rows[$column] = $row;
  34428. return $this;
  34429. }
  34430. public function render()
  34431. {
  34432. $this->calculateNumberOfColumns();
  34433. $rows = $this->buildTableRows($this->rows);
  34434. $headers = $this->buildTableRows($this->headers);
  34435. $this->calculateColumnsWidth(array_merge($headers, $rows));
  34436. $this->renderRowSeparator();
  34437. if (!empty($headers)) {
  34438. foreach ($headers as $header) {
  34439. $this->renderRow($header, $this->style->getCellHeaderFormat());
  34440. $this->renderRowSeparator();
  34441. }
  34442. }
  34443. foreach ($rows as $row) {
  34444. if ($row instanceof TableSeparator) {
  34445. $this->renderRowSeparator();
  34446. } else {
  34447. $this->renderRow($row, $this->style->getCellRowFormat());
  34448. }
  34449. }
  34450. if (!empty($rows)) {
  34451. $this->renderRowSeparator();
  34452. }
  34453. $this->cleanup();
  34454. }
  34455. private function renderRowSeparator()
  34456. {
  34457. if (0 === $count = $this->numberOfColumns) {
  34458. return;
  34459. }
  34460. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  34461. return;
  34462. }
  34463. $markup = $this->style->getCrossingChar();
  34464. for ($column = 0; $column < $count; ++$column) {
  34465. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  34466. }
  34467. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  34468. }
  34469. private function renderColumnSeparator()
  34470. {
  34471. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  34472. }
  34473. private function renderRow(array $row, $cellFormat)
  34474. {
  34475. if (empty($row)) {
  34476. return;
  34477. }
  34478. $rowContent = $this->renderColumnSeparator();
  34479. foreach ($this->getRowColumns($row) as $column) {
  34480. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  34481. $rowContent .= $this->renderColumnSeparator();
  34482. }
  34483. $this->output->writeln($rowContent);
  34484. }
  34485. private function renderCell(array $row, $column, $cellFormat)
  34486. {
  34487. $cell = isset($row[$column]) ? $row[$column] : '';
  34488. $width = $this->columnWidths[$column];
  34489. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  34490. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  34491. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  34492. }
  34493. }
  34494. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  34495. $width += strlen($cell) - mb_strwidth($cell, $encoding);
  34496. }
  34497. $style = $this->getColumnStyle($column);
  34498. if ($cell instanceof TableSeparator) {
  34499. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  34500. }
  34501. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  34502. $content = sprintf($style->getCellRowContentFormat(), $cell);
  34503. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  34504. }
  34505. private function calculateNumberOfColumns()
  34506. {
  34507. if (null !== $this->numberOfColumns) {
  34508. return;
  34509. }
  34510. $columns = array(0);
  34511. foreach (array_merge($this->headers, $this->rows) as $row) {
  34512. if ($row instanceof TableSeparator) {
  34513. continue;
  34514. }
  34515. $columns[] = $this->getNumberOfColumns($row);
  34516. }
  34517. $this->numberOfColumns = max($columns);
  34518. }
  34519. private function buildTableRows($rows)
  34520. {
  34521. $unmergedRows = array();
  34522. for ($rowKey = 0; $rowKey < count($rows); ++$rowKey) {
  34523. $rows = $this->fillNextRows($rows, $rowKey);
  34524. foreach ($rows[$rowKey] as $column => $cell) {
  34525. if (!strstr($cell, "\n")) {
  34526. continue;
  34527. }
  34528. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  34529. foreach ($lines as $lineKey => $line) {
  34530. if ($cell instanceof TableCell) {
  34531. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  34532. }
  34533. if (0 === $lineKey) {
  34534. $rows[$rowKey][$column] = $line;
  34535. } else {
  34536. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  34537. }
  34538. }
  34539. }
  34540. }
  34541. $tableRows = array();
  34542. foreach ($rows as $rowKey => $row) {
  34543. $tableRows[] = $this->fillCells($row);
  34544. if (isset($unmergedRows[$rowKey])) {
  34545. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  34546. }
  34547. }
  34548. return $tableRows;
  34549. }
  34550. private function fillNextRows(array $rows, $line)
  34551. {
  34552. $unmergedRows = array();
  34553. foreach ($rows[$line] as $column => $cell) {
  34554. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  34555. $nbLines = $cell->getRowspan() - 1;
  34556. $lines = array($cell);
  34557. if (strstr($cell, "\n")) {
  34558. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  34559. $nbLines = count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  34560. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  34561. unset($lines[0]);
  34562. }
  34563. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  34564. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  34565. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  34566. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  34567. if ($nbLines === $unmergedRowKey - $line) {
  34568. break;
  34569. }
  34570. }
  34571. }
  34572. }
  34573. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  34574. if (isset($rows[$unmergedRowKey]) && is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  34575. foreach ($unmergedRow as $cellKey => $cell) {
  34576. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  34577. }
  34578. } else {
  34579. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  34580. foreach ($unmergedRow as $column => $cell) {
  34581. if (!empty($cell)) {
  34582. $row[$column] = $unmergedRow[$column];
  34583. }
  34584. }
  34585. array_splice($rows, $unmergedRowKey, 0, array($row));
  34586. }
  34587. }
  34588. return $rows;
  34589. }
  34590. private function fillCells($row)
  34591. {
  34592. $newRow = array();
  34593. foreach ($row as $column => $cell) {
  34594. $newRow[] = $cell;
  34595. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  34596. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  34597. $newRow[] = '';
  34598. }
  34599. }
  34600. }
  34601. return $newRow ?: $row;
  34602. }
  34603. private function copyRow(array $rows, $line)
  34604. {
  34605. $row = $rows[$line];
  34606. foreach ($row as $cellKey => $cellValue) {
  34607. $row[$cellKey] = '';
  34608. if ($cellValue instanceof TableCell) {
  34609. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  34610. }
  34611. }
  34612. return $row;
  34613. }
  34614. private function getNumberOfColumns(array $row)
  34615. {
  34616. $columns = count($row);
  34617. foreach ($row as $column) {
  34618. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  34619. }
  34620. return $columns;
  34621. }
  34622. private function getRowColumns(array $row)
  34623. {
  34624. $columns = range(0, $this->numberOfColumns - 1);
  34625. foreach ($row as $cellKey => $cell) {
  34626. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  34627. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  34628. }
  34629. }
  34630. return $columns;
  34631. }
  34632. private function calculateColumnsWidth($rows)
  34633. {
  34634. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  34635. $lengths = array();
  34636. foreach ($rows as $row) {
  34637. if ($row instanceof TableSeparator) {
  34638. continue;
  34639. }
  34640. foreach ($row as $i => $cell) {
  34641. if ($cell instanceof TableCell) {
  34642. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  34643. $textLength = Helper::strlen($textContent);
  34644. if ($textLength > 0) {
  34645. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  34646. foreach ($contentColumns as $position => $content) {
  34647. $row[$i + $position] = $content;
  34648. }
  34649. }
  34650. }
  34651. }
  34652. $lengths[] = $this->getCellWidth($row, $column);
  34653. }
  34654. $this->columnWidths[$column] = max($lengths) + strlen($this->style->getCellRowContentFormat()) - 2;
  34655. }
  34656. }
  34657. private function getColumnSeparatorWidth()
  34658. {
  34659. return strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  34660. }
  34661. private function getCellWidth(array $row, $column)
  34662. {
  34663. if (isset($row[$column])) {
  34664. $cell = $row[$column];
  34665. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  34666. return $cellWidth;
  34667. }
  34668. return 0;
  34669. }
  34670. private function cleanup()
  34671. {
  34672. $this->columnWidths = array();
  34673. $this->numberOfColumns = null;
  34674. }
  34675. private static function initStyles()
  34676. {
  34677. $borderless = new TableStyle();
  34678. $borderless
  34679. ->setHorizontalBorderChar('=')
  34680. ->setVerticalBorderChar(' ')
  34681. ->setCrossingChar(' ')
  34682. ;
  34683. $compact = new TableStyle();
  34684. $compact
  34685. ->setHorizontalBorderChar('')
  34686. ->setVerticalBorderChar(' ')
  34687. ->setCrossingChar('')
  34688. ->setCellRowContentFormat('%s')
  34689. ;
  34690. $styleGuide = new TableStyle();
  34691. $styleGuide
  34692. ->setHorizontalBorderChar('-')
  34693. ->setVerticalBorderChar(' ')
  34694. ->setCrossingChar(' ')
  34695. ->setCellHeaderFormat('%s')
  34696. ;
  34697. return array(
  34698. 'default' => new TableStyle(),
  34699. 'borderless' => $borderless,
  34700. 'compact' => $compact,
  34701. 'symfony-style-guide' => $styleGuide,
  34702. );
  34703. }
  34704. private function resolveStyle($name)
  34705. {
  34706. if ($name instanceof TableStyle) {
  34707. return $name;
  34708. }
  34709. if (isset(self::$styles[$name])) {
  34710. return self::$styles[$name];
  34711. }
  34712. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  34713. }
  34714. }
  34715. <?php
  34716. namespace Symfony\Component\Console\Helper;
  34717. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34718. class TableCell
  34719. {
  34720. private $value;
  34721. private $options = array(
  34722. 'rowspan' => 1,
  34723. 'colspan' => 1,
  34724. );
  34725. public function __construct($value = '', array $options = array())
  34726. {
  34727. if (is_numeric($value) && !is_string($value)) {
  34728. $value = (string) $value;
  34729. }
  34730. $this->value = $value;
  34731. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  34732. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  34733. }
  34734. $this->options = array_merge($this->options, $options);
  34735. }
  34736. public function __toString()
  34737. {
  34738. return $this->value;
  34739. }
  34740. public function getColspan()
  34741. {
  34742. return (int) $this->options['colspan'];
  34743. }
  34744. public function getRowspan()
  34745. {
  34746. return (int) $this->options['rowspan'];
  34747. }
  34748. }
  34749. <?php
  34750. namespace Symfony\Component\Console\Helper;
  34751. use Symfony\Component\Console\Output\OutputInterface;
  34752. use Symfony\Component\Console\Output\NullOutput;
  34753. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34754. class TableHelper extends Helper
  34755. {
  34756. const LAYOUT_DEFAULT = 0;
  34757. const LAYOUT_BORDERLESS = 1;
  34758. const LAYOUT_COMPACT = 2;
  34759. private $table;
  34760. public function __construct($triggerDeprecationError = true)
  34761. {
  34762. if ($triggerDeprecationError) {
  34763. @trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  34764. }
  34765. $this->table = new Table(new NullOutput());
  34766. }
  34767. public function setLayout($layout)
  34768. {
  34769. switch ($layout) {
  34770. case self::LAYOUT_BORDERLESS:
  34771. $this->table->setStyle('borderless');
  34772. break;
  34773. case self::LAYOUT_COMPACT:
  34774. $this->table->setStyle('compact');
  34775. break;
  34776. case self::LAYOUT_DEFAULT:
  34777. $this->table->setStyle('default');
  34778. break;
  34779. default:
  34780. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  34781. }
  34782. return $this;
  34783. }
  34784. public function setHeaders(array $headers)
  34785. {
  34786. $this->table->setHeaders($headers);
  34787. return $this;
  34788. }
  34789. public function setRows(array $rows)
  34790. {
  34791. $this->table->setRows($rows);
  34792. return $this;
  34793. }
  34794. public function addRows(array $rows)
  34795. {
  34796. $this->table->addRows($rows);
  34797. return $this;
  34798. }
  34799. public function addRow(array $row)
  34800. {
  34801. $this->table->addRow($row);
  34802. return $this;
  34803. }
  34804. public function setRow($column, array $row)
  34805. {
  34806. $this->table->setRow($column, $row);
  34807. return $this;
  34808. }
  34809. public function setPaddingChar($paddingChar)
  34810. {
  34811. $this->table->getStyle()->setPaddingChar($paddingChar);
  34812. return $this;
  34813. }
  34814. public function setHorizontalBorderChar($horizontalBorderChar)
  34815. {
  34816. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  34817. return $this;
  34818. }
  34819. public function setVerticalBorderChar($verticalBorderChar)
  34820. {
  34821. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  34822. return $this;
  34823. }
  34824. public function setCrossingChar($crossingChar)
  34825. {
  34826. $this->table->getStyle()->setCrossingChar($crossingChar);
  34827. return $this;
  34828. }
  34829. public function setCellHeaderFormat($cellHeaderFormat)
  34830. {
  34831. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  34832. return $this;
  34833. }
  34834. public function setCellRowFormat($cellRowFormat)
  34835. {
  34836. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  34837. return $this;
  34838. }
  34839. public function setCellRowContentFormat($cellRowContentFormat)
  34840. {
  34841. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  34842. return $this;
  34843. }
  34844. public function setBorderFormat($borderFormat)
  34845. {
  34846. $this->table->getStyle()->setBorderFormat($borderFormat);
  34847. return $this;
  34848. }
  34849. public function setPadType($padType)
  34850. {
  34851. $this->table->getStyle()->setPadType($padType);
  34852. return $this;
  34853. }
  34854. public function render(OutputInterface $output)
  34855. {
  34856. $p = new \ReflectionProperty($this->table, 'output');
  34857. $p->setAccessible(true);
  34858. $p->setValue($this->table, $output);
  34859. $this->table->render();
  34860. }
  34861. public function getName()
  34862. {
  34863. return 'table';
  34864. }
  34865. }
  34866. <?php
  34867. namespace Symfony\Component\Console\Helper;
  34868. class TableSeparator extends TableCell
  34869. {
  34870. public function __construct(array $options = array())
  34871. {
  34872. parent::__construct('', $options);
  34873. }
  34874. }
  34875. <?php
  34876. namespace Symfony\Component\Console\Helper;
  34877. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34878. use Symfony\Component\Console\Exception\LogicException;
  34879. class TableStyle
  34880. {
  34881. private $paddingChar = ' ';
  34882. private $horizontalBorderChar = '-';
  34883. private $verticalBorderChar = '|';
  34884. private $crossingChar = '+';
  34885. private $cellHeaderFormat = '<info>%s</info>';
  34886. private $cellRowFormat = '%s';
  34887. private $cellRowContentFormat = ' %s ';
  34888. private $borderFormat = '%s';
  34889. private $padType = STR_PAD_RIGHT;
  34890. public function setPaddingChar($paddingChar)
  34891. {
  34892. if (!$paddingChar) {
  34893. throw new LogicException('The padding char must not be empty');
  34894. }
  34895. $this->paddingChar = $paddingChar;
  34896. return $this;
  34897. }
  34898. public function getPaddingChar()
  34899. {
  34900. return $this->paddingChar;
  34901. }
  34902. public function setHorizontalBorderChar($horizontalBorderChar)
  34903. {
  34904. $this->horizontalBorderChar = $horizontalBorderChar;
  34905. return $this;
  34906. }
  34907. public function getHorizontalBorderChar()
  34908. {
  34909. return $this->horizontalBorderChar;
  34910. }
  34911. public function setVerticalBorderChar($verticalBorderChar)
  34912. {
  34913. $this->verticalBorderChar = $verticalBorderChar;
  34914. return $this;
  34915. }
  34916. public function getVerticalBorderChar()
  34917. {
  34918. return $this->verticalBorderChar;
  34919. }
  34920. public function setCrossingChar($crossingChar)
  34921. {
  34922. $this->crossingChar = $crossingChar;
  34923. return $this;
  34924. }
  34925. public function getCrossingChar()
  34926. {
  34927. return $this->crossingChar;
  34928. }
  34929. public function setCellHeaderFormat($cellHeaderFormat)
  34930. {
  34931. $this->cellHeaderFormat = $cellHeaderFormat;
  34932. return $this;
  34933. }
  34934. public function getCellHeaderFormat()
  34935. {
  34936. return $this->cellHeaderFormat;
  34937. }
  34938. public function setCellRowFormat($cellRowFormat)
  34939. {
  34940. $this->cellRowFormat = $cellRowFormat;
  34941. return $this;
  34942. }
  34943. public function getCellRowFormat()
  34944. {
  34945. return $this->cellRowFormat;
  34946. }
  34947. public function setCellRowContentFormat($cellRowContentFormat)
  34948. {
  34949. $this->cellRowContentFormat = $cellRowContentFormat;
  34950. return $this;
  34951. }
  34952. public function getCellRowContentFormat()
  34953. {
  34954. return $this->cellRowContentFormat;
  34955. }
  34956. public function setBorderFormat($borderFormat)
  34957. {
  34958. $this->borderFormat = $borderFormat;
  34959. return $this;
  34960. }
  34961. public function getBorderFormat()
  34962. {
  34963. return $this->borderFormat;
  34964. }
  34965. public function setPadType($padType)
  34966. {
  34967. if (!in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  34968. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  34969. }
  34970. $this->padType = $padType;
  34971. return $this;
  34972. }
  34973. public function getPadType()
  34974. {
  34975. return $this->padType;
  34976. }
  34977. }
  34978. <?php
  34979. namespace Symfony\Component\Console\Input;
  34980. use Symfony\Component\Console\Exception\RuntimeException;
  34981. class ArgvInput extends Input
  34982. {
  34983. private $tokens;
  34984. private $parsed;
  34985. public function __construct(array $argv = null, InputDefinition $definition = null)
  34986. {
  34987. if (null === $argv) {
  34988. $argv = $_SERVER['argv'];
  34989. }
  34990. array_shift($argv);
  34991. $this->tokens = $argv;
  34992. parent::__construct($definition);
  34993. }
  34994. protected function setTokens(array $tokens)
  34995. {
  34996. $this->tokens = $tokens;
  34997. }
  34998. protected function parse()
  34999. {
  35000. $parseOptions = true;
  35001. $this->parsed = $this->tokens;
  35002. while (null !== $token = array_shift($this->parsed)) {
  35003. if ($parseOptions && '' == $token) {
  35004. $this->parseArgument($token);
  35005. } elseif ($parseOptions && '--' == $token) {
  35006. $parseOptions = false;
  35007. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  35008. $this->parseLongOption($token);
  35009. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  35010. $this->parseShortOption($token);
  35011. } else {
  35012. $this->parseArgument($token);
  35013. }
  35014. }
  35015. }
  35016. private function parseShortOption($token)
  35017. {
  35018. $name = substr($token, 1);
  35019. if (strlen($name) > 1) {
  35020. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  35021. $this->addShortOption($name[0], substr($name, 1));
  35022. } else {
  35023. $this->parseShortOptionSet($name);
  35024. }
  35025. } else {
  35026. $this->addShortOption($name, null);
  35027. }
  35028. }
  35029. private function parseShortOptionSet($name)
  35030. {
  35031. $len = strlen($name);
  35032. for ($i = 0; $i < $len; ++$i) {
  35033. if (!$this->definition->hasShortcut($name[$i])) {
  35034. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
  35035. }
  35036. $option = $this->definition->getOptionForShortcut($name[$i]);
  35037. if ($option->acceptValue()) {
  35038. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  35039. break;
  35040. } else {
  35041. $this->addLongOption($option->getName(), null);
  35042. }
  35043. }
  35044. }
  35045. private function parseLongOption($token)
  35046. {
  35047. $name = substr($token, 2);
  35048. if (false !== $pos = strpos($name, '=')) {
  35049. if (0 === strlen($value = substr($name, $pos + 1))) {
  35050. array_unshift($this->parsed, null);
  35051. }
  35052. $this->addLongOption(substr($name, 0, $pos), $value);
  35053. } else {
  35054. $this->addLongOption($name, null);
  35055. }
  35056. }
  35057. private function parseArgument($token)
  35058. {
  35059. $c = count($this->arguments);
  35060. if ($this->definition->hasArgument($c)) {
  35061. $arg = $this->definition->getArgument($c);
  35062. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  35063. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  35064. $arg = $this->definition->getArgument($c - 1);
  35065. $this->arguments[$arg->getName()][] = $token;
  35066. } else {
  35067. $all = $this->definition->getArguments();
  35068. if (count($all)) {
  35069. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  35070. }
  35071. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  35072. }
  35073. }
  35074. private function addShortOption($shortcut, $value)
  35075. {
  35076. if (!$this->definition->hasShortcut($shortcut)) {
  35077. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  35078. }
  35079. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  35080. }
  35081. private function addLongOption($name, $value)
  35082. {
  35083. if (!$this->definition->hasOption($name)) {
  35084. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  35085. }
  35086. $option = $this->definition->getOption($name);
  35087. if (!isset($value[0])) {
  35088. $value = null;
  35089. }
  35090. if (null !== $value && !$option->acceptValue()) {
  35091. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  35092. }
  35093. if (null === $value && $option->acceptValue() && count($this->parsed)) {
  35094. $next = array_shift($this->parsed);
  35095. if (isset($next[0]) && '-' !== $next[0]) {
  35096. $value = $next;
  35097. } elseif (empty($next)) {
  35098. $value = null;
  35099. } else {
  35100. array_unshift($this->parsed, $next);
  35101. }
  35102. }
  35103. if (null === $value) {
  35104. if ($option->isValueRequired()) {
  35105. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  35106. }
  35107. if (!$option->isArray()) {
  35108. $value = $option->isValueOptional() ? $option->getDefault() : true;
  35109. }
  35110. }
  35111. if ($option->isArray()) {
  35112. $this->options[$name][] = $value;
  35113. } else {
  35114. $this->options[$name] = $value;
  35115. }
  35116. }
  35117. public function getFirstArgument()
  35118. {
  35119. foreach ($this->tokens as $token) {
  35120. if ($token && '-' === $token[0]) {
  35121. continue;
  35122. }
  35123. return $token;
  35124. }
  35125. }
  35126. public function hasParameterOption($values)
  35127. {
  35128. $values = (array) $values;
  35129. foreach ($this->tokens as $token) {
  35130. foreach ($values as $value) {
  35131. if ($token === $value || 0 === strpos($token, $value.'=')) {
  35132. return true;
  35133. }
  35134. if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) {
  35135. $searchableToken = str_replace('-', '', $token);
  35136. $searchableValue = str_replace('-', '', $value);
  35137. if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) {
  35138. return true;
  35139. }
  35140. }
  35141. }
  35142. }
  35143. return false;
  35144. }
  35145. public function getParameterOption($values, $default = false)
  35146. {
  35147. $values = (array) $values;
  35148. $tokens = $this->tokens;
  35149. while (0 < count($tokens)) {
  35150. $token = array_shift($tokens);
  35151. foreach ($values as $value) {
  35152. if ($token === $value || 0 === strpos($token, $value.'=')) {
  35153. if (false !== $pos = strpos($token, '=')) {
  35154. return substr($token, $pos + 1);
  35155. }
  35156. return array_shift($tokens);
  35157. }
  35158. }
  35159. }
  35160. return $default;
  35161. }
  35162. public function __toString()
  35163. {
  35164. $self = $this;
  35165. $tokens = array_map(function ($token) use ($self) {
  35166. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  35167. return $match[1].$self->escapeToken($match[2]);
  35168. }
  35169. if ($token && '-' !== $token[0]) {
  35170. return $self->escapeToken($token);
  35171. }
  35172. return $token;
  35173. }, $this->tokens);
  35174. return implode(' ', $tokens);
  35175. }
  35176. }
  35177. <?php
  35178. namespace Symfony\Component\Console\Input;
  35179. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35180. use Symfony\Component\Console\Exception\InvalidOptionException;
  35181. class ArrayInput extends Input
  35182. {
  35183. private $parameters;
  35184. public function __construct(array $parameters, InputDefinition $definition = null)
  35185. {
  35186. $this->parameters = $parameters;
  35187. parent::__construct($definition);
  35188. }
  35189. public function getFirstArgument()
  35190. {
  35191. foreach ($this->parameters as $key => $value) {
  35192. if ($key && '-' === $key[0]) {
  35193. continue;
  35194. }
  35195. return $value;
  35196. }
  35197. }
  35198. public function hasParameterOption($values)
  35199. {
  35200. $values = (array) $values;
  35201. foreach ($this->parameters as $k => $v) {
  35202. if (!is_int($k)) {
  35203. $v = $k;
  35204. }
  35205. if (in_array($v, $values)) {
  35206. return true;
  35207. }
  35208. }
  35209. return false;
  35210. }
  35211. public function getParameterOption($values, $default = false)
  35212. {
  35213. $values = (array) $values;
  35214. foreach ($this->parameters as $k => $v) {
  35215. if (is_int($k)) {
  35216. if (in_array($v, $values)) {
  35217. return true;
  35218. }
  35219. } elseif (in_array($k, $values)) {
  35220. return $v;
  35221. }
  35222. }
  35223. return $default;
  35224. }
  35225. public function __toString()
  35226. {
  35227. $params = array();
  35228. foreach ($this->parameters as $param => $val) {
  35229. if ($param && '-' === $param[0]) {
  35230. if (is_array($val)) {
  35231. foreach ($val as $v) {
  35232. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  35233. }
  35234. } else {
  35235. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  35236. }
  35237. } else {
  35238. $params[] = is_array($val) ? array_map(array($this, 'escapeToken'), $val) : $this->escapeToken($val);
  35239. }
  35240. }
  35241. return implode(' ', $params);
  35242. }
  35243. protected function parse()
  35244. {
  35245. foreach ($this->parameters as $key => $value) {
  35246. if (0 === strpos($key, '--')) {
  35247. $this->addLongOption(substr($key, 2), $value);
  35248. } elseif ('-' === $key[0]) {
  35249. $this->addShortOption(substr($key, 1), $value);
  35250. } else {
  35251. $this->addArgument($key, $value);
  35252. }
  35253. }
  35254. }
  35255. private function addShortOption($shortcut, $value)
  35256. {
  35257. if (!$this->definition->hasShortcut($shortcut)) {
  35258. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  35259. }
  35260. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  35261. }
  35262. private function addLongOption($name, $value)
  35263. {
  35264. if (!$this->definition->hasOption($name)) {
  35265. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  35266. }
  35267. $option = $this->definition->getOption($name);
  35268. if (null === $value) {
  35269. if ($option->isValueRequired()) {
  35270. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  35271. }
  35272. $value = $option->isValueOptional() ? $option->getDefault() : true;
  35273. }
  35274. $this->options[$name] = $value;
  35275. }
  35276. private function addArgument($name, $value)
  35277. {
  35278. if (!$this->definition->hasArgument($name)) {
  35279. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35280. }
  35281. $this->arguments[$name] = $value;
  35282. }
  35283. }
  35284. <?php
  35285. namespace Symfony\Component\Console\Input;
  35286. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35287. use Symfony\Component\Console\Exception\RuntimeException;
  35288. abstract class Input implements InputInterface
  35289. {
  35290. protected $definition;
  35291. protected $options = array();
  35292. protected $arguments = array();
  35293. protected $interactive = true;
  35294. public function __construct(InputDefinition $definition = null)
  35295. {
  35296. if (null === $definition) {
  35297. $this->definition = new InputDefinition();
  35298. } else {
  35299. $this->bind($definition);
  35300. $this->validate();
  35301. }
  35302. }
  35303. public function bind(InputDefinition $definition)
  35304. {
  35305. $this->arguments = array();
  35306. $this->options = array();
  35307. $this->definition = $definition;
  35308. $this->parse();
  35309. }
  35310. abstract protected function parse();
  35311. public function validate()
  35312. {
  35313. $definition = $this->definition;
  35314. $givenArguments = $this->arguments;
  35315. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  35316. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  35317. });
  35318. if (count($missingArguments) > 0) {
  35319. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  35320. }
  35321. }
  35322. public function isInteractive()
  35323. {
  35324. return $this->interactive;
  35325. }
  35326. public function setInteractive($interactive)
  35327. {
  35328. $this->interactive = (bool) $interactive;
  35329. }
  35330. public function getArguments()
  35331. {
  35332. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  35333. }
  35334. public function getArgument($name)
  35335. {
  35336. if (!$this->definition->hasArgument($name)) {
  35337. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35338. }
  35339. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  35340. }
  35341. public function setArgument($name, $value)
  35342. {
  35343. if (!$this->definition->hasArgument($name)) {
  35344. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35345. }
  35346. $this->arguments[$name] = $value;
  35347. }
  35348. public function hasArgument($name)
  35349. {
  35350. return $this->definition->hasArgument($name);
  35351. }
  35352. public function getOptions()
  35353. {
  35354. return array_merge($this->definition->getOptionDefaults(), $this->options);
  35355. }
  35356. public function getOption($name)
  35357. {
  35358. if (!$this->definition->hasOption($name)) {
  35359. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  35360. }
  35361. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  35362. }
  35363. public function setOption($name, $value)
  35364. {
  35365. if (!$this->definition->hasOption($name)) {
  35366. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  35367. }
  35368. $this->options[$name] = $value;
  35369. }
  35370. public function hasOption($name)
  35371. {
  35372. return $this->definition->hasOption($name);
  35373. }
  35374. public function escapeToken($token)
  35375. {
  35376. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  35377. }
  35378. }
  35379. <?php
  35380. namespace Symfony\Component\Console\Input;
  35381. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35382. use Symfony\Component\Console\Exception\LogicException;
  35383. class InputArgument
  35384. {
  35385. const REQUIRED = 1;
  35386. const OPTIONAL = 2;
  35387. const IS_ARRAY = 4;
  35388. private $name;
  35389. private $mode;
  35390. private $default;
  35391. private $description;
  35392. public function __construct($name, $mode = null, $description = '', $default = null)
  35393. {
  35394. if (null === $mode) {
  35395. $mode = self::OPTIONAL;
  35396. } elseif (!is_int($mode) || $mode > 7 || $mode < 1) {
  35397. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  35398. }
  35399. $this->name = $name;
  35400. $this->mode = $mode;
  35401. $this->description = $description;
  35402. $this->setDefault($default);
  35403. }
  35404. public function getName()
  35405. {
  35406. return $this->name;
  35407. }
  35408. public function isRequired()
  35409. {
  35410. return self::REQUIRED === (self::REQUIRED & $this->mode);
  35411. }
  35412. public function isArray()
  35413. {
  35414. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  35415. }
  35416. public function setDefault($default = null)
  35417. {
  35418. if (self::REQUIRED === $this->mode && null !== $default) {
  35419. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  35420. }
  35421. if ($this->isArray()) {
  35422. if (null === $default) {
  35423. $default = array();
  35424. } elseif (!is_array($default)) {
  35425. throw new LogicException('A default value for an array argument must be an array.');
  35426. }
  35427. }
  35428. $this->default = $default;
  35429. }
  35430. public function getDefault()
  35431. {
  35432. return $this->default;
  35433. }
  35434. public function getDescription()
  35435. {
  35436. return $this->description;
  35437. }
  35438. }
  35439. <?php
  35440. namespace Symfony\Component\Console\Input;
  35441. interface InputAwareInterface
  35442. {
  35443. public function setInput(InputInterface $input);
  35444. }
  35445. <?php
  35446. namespace Symfony\Component\Console\Input;
  35447. use Symfony\Component\Console\Descriptor\TextDescriptor;
  35448. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  35449. use Symfony\Component\Console\Output\BufferedOutput;
  35450. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35451. use Symfony\Component\Console\Exception\LogicException;
  35452. class InputDefinition
  35453. {
  35454. private $arguments;
  35455. private $requiredCount;
  35456. private $hasAnArrayArgument = false;
  35457. private $hasOptional;
  35458. private $options;
  35459. private $shortcuts;
  35460. public function __construct(array $definition = array())
  35461. {
  35462. $this->setDefinition($definition);
  35463. }
  35464. public function setDefinition(array $definition)
  35465. {
  35466. $arguments = array();
  35467. $options = array();
  35468. foreach ($definition as $item) {
  35469. if ($item instanceof InputOption) {
  35470. $options[] = $item;
  35471. } else {
  35472. $arguments[] = $item;
  35473. }
  35474. }
  35475. $this->setArguments($arguments);
  35476. $this->setOptions($options);
  35477. }
  35478. public function setArguments($arguments = array())
  35479. {
  35480. $this->arguments = array();
  35481. $this->requiredCount = 0;
  35482. $this->hasOptional = false;
  35483. $this->hasAnArrayArgument = false;
  35484. $this->addArguments($arguments);
  35485. }
  35486. public function addArguments($arguments = array())
  35487. {
  35488. if (null !== $arguments) {
  35489. foreach ($arguments as $argument) {
  35490. $this->addArgument($argument);
  35491. }
  35492. }
  35493. }
  35494. public function addArgument(InputArgument $argument)
  35495. {
  35496. if (isset($this->arguments[$argument->getName()])) {
  35497. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  35498. }
  35499. if ($this->hasAnArrayArgument) {
  35500. throw new LogicException('Cannot add an argument after an array argument.');
  35501. }
  35502. if ($argument->isRequired() && $this->hasOptional) {
  35503. throw new LogicException('Cannot add a required argument after an optional one.');
  35504. }
  35505. if ($argument->isArray()) {
  35506. $this->hasAnArrayArgument = true;
  35507. }
  35508. if ($argument->isRequired()) {
  35509. ++$this->requiredCount;
  35510. } else {
  35511. $this->hasOptional = true;
  35512. }
  35513. $this->arguments[$argument->getName()] = $argument;
  35514. }
  35515. public function getArgument($name)
  35516. {
  35517. if (!$this->hasArgument($name)) {
  35518. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35519. }
  35520. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  35521. return $arguments[$name];
  35522. }
  35523. public function hasArgument($name)
  35524. {
  35525. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  35526. return isset($arguments[$name]);
  35527. }
  35528. public function getArguments()
  35529. {
  35530. return $this->arguments;
  35531. }
  35532. public function getArgumentCount()
  35533. {
  35534. return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments);
  35535. }
  35536. public function getArgumentRequiredCount()
  35537. {
  35538. return $this->requiredCount;
  35539. }
  35540. public function getArgumentDefaults()
  35541. {
  35542. $values = array();
  35543. foreach ($this->arguments as $argument) {
  35544. $values[$argument->getName()] = $argument->getDefault();
  35545. }
  35546. return $values;
  35547. }
  35548. public function setOptions($options = array())
  35549. {
  35550. $this->options = array();
  35551. $this->shortcuts = array();
  35552. $this->addOptions($options);
  35553. }
  35554. public function addOptions($options = array())
  35555. {
  35556. foreach ($options as $option) {
  35557. $this->addOption($option);
  35558. }
  35559. }
  35560. public function addOption(InputOption $option)
  35561. {
  35562. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  35563. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  35564. }
  35565. if ($option->getShortcut()) {
  35566. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  35567. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  35568. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  35569. }
  35570. }
  35571. }
  35572. $this->options[$option->getName()] = $option;
  35573. if ($option->getShortcut()) {
  35574. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  35575. $this->shortcuts[$shortcut] = $option->getName();
  35576. }
  35577. }
  35578. }
  35579. public function getOption($name)
  35580. {
  35581. if (!$this->hasOption($name)) {
  35582. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  35583. }
  35584. return $this->options[$name];
  35585. }
  35586. public function hasOption($name)
  35587. {
  35588. return isset($this->options[$name]);
  35589. }
  35590. public function getOptions()
  35591. {
  35592. return $this->options;
  35593. }
  35594. public function hasShortcut($name)
  35595. {
  35596. return isset($this->shortcuts[$name]);
  35597. }
  35598. public function getOptionForShortcut($shortcut)
  35599. {
  35600. return $this->getOption($this->shortcutToName($shortcut));
  35601. }
  35602. public function getOptionDefaults()
  35603. {
  35604. $values = array();
  35605. foreach ($this->options as $option) {
  35606. $values[$option->getName()] = $option->getDefault();
  35607. }
  35608. return $values;
  35609. }
  35610. private function shortcutToName($shortcut)
  35611. {
  35612. if (!isset($this->shortcuts[$shortcut])) {
  35613. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  35614. }
  35615. return $this->shortcuts[$shortcut];
  35616. }
  35617. public function getSynopsis($short = false)
  35618. {
  35619. $elements = array();
  35620. if ($short && $this->getOptions()) {
  35621. $elements[] = '[options]';
  35622. } elseif (!$short) {
  35623. foreach ($this->getOptions() as $option) {
  35624. $value = '';
  35625. if ($option->acceptValue()) {
  35626. $value = sprintf(
  35627. ' %s%s%s',
  35628. $option->isValueOptional() ? '[' : '',
  35629. strtoupper($option->getName()),
  35630. $option->isValueOptional() ? ']' : ''
  35631. );
  35632. }
  35633. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  35634. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  35635. }
  35636. }
  35637. if (count($elements) && $this->getArguments()) {
  35638. $elements[] = '[--]';
  35639. }
  35640. foreach ($this->getArguments() as $argument) {
  35641. $element = '<'.$argument->getName().'>';
  35642. if (!$argument->isRequired()) {
  35643. $element = '['.$element.']';
  35644. } elseif ($argument->isArray()) {
  35645. $element = $element.' ('.$element.')';
  35646. }
  35647. if ($argument->isArray()) {
  35648. $element .= '...';
  35649. }
  35650. $elements[] = $element;
  35651. }
  35652. return implode(' ', $elements);
  35653. }
  35654. public function asText()
  35655. {
  35656. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  35657. $descriptor = new TextDescriptor();
  35658. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  35659. $descriptor->describe($output, $this, array('raw_output' => true));
  35660. return $output->fetch();
  35661. }
  35662. public function asXml($asDom = false)
  35663. {
  35664. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  35665. $descriptor = new XmlDescriptor();
  35666. if ($asDom) {
  35667. return $descriptor->getInputDefinitionDocument($this);
  35668. }
  35669. $output = new BufferedOutput();
  35670. $descriptor->describe($output, $this);
  35671. return $output->fetch();
  35672. }
  35673. }
  35674. <?php
  35675. namespace Symfony\Component\Console\Input;
  35676. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35677. use Symfony\Component\Console\Exception\RuntimeException;
  35678. interface InputInterface
  35679. {
  35680. public function getFirstArgument();
  35681. public function hasParameterOption($values);
  35682. public function getParameterOption($values, $default = false);
  35683. public function bind(InputDefinition $definition);
  35684. public function validate();
  35685. public function getArguments();
  35686. public function getArgument($name);
  35687. public function setArgument($name, $value);
  35688. public function hasArgument($name);
  35689. public function getOptions();
  35690. public function getOption($name);
  35691. public function setOption($name, $value);
  35692. public function hasOption($name);
  35693. public function isInteractive();
  35694. public function setInteractive($interactive);
  35695. }
  35696. <?php
  35697. namespace Symfony\Component\Console\Input;
  35698. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35699. use Symfony\Component\Console\Exception\LogicException;
  35700. class InputOption
  35701. {
  35702. const VALUE_NONE = 1;
  35703. const VALUE_REQUIRED = 2;
  35704. const VALUE_OPTIONAL = 4;
  35705. const VALUE_IS_ARRAY = 8;
  35706. private $name;
  35707. private $shortcut;
  35708. private $mode;
  35709. private $default;
  35710. private $description;
  35711. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  35712. {
  35713. if (0 === strpos($name, '--')) {
  35714. $name = substr($name, 2);
  35715. }
  35716. if (empty($name)) {
  35717. throw new InvalidArgumentException('An option name cannot be empty.');
  35718. }
  35719. if (empty($shortcut)) {
  35720. $shortcut = null;
  35721. }
  35722. if (null !== $shortcut) {
  35723. if (is_array($shortcut)) {
  35724. $shortcut = implode('|', $shortcut);
  35725. }
  35726. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  35727. $shortcuts = array_filter($shortcuts);
  35728. $shortcut = implode('|', $shortcuts);
  35729. if (empty($shortcut)) {
  35730. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  35731. }
  35732. }
  35733. if (null === $mode) {
  35734. $mode = self::VALUE_NONE;
  35735. } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
  35736. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  35737. }
  35738. $this->name = $name;
  35739. $this->shortcut = $shortcut;
  35740. $this->mode = $mode;
  35741. $this->description = $description;
  35742. if ($this->isArray() && !$this->acceptValue()) {
  35743. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  35744. }
  35745. $this->setDefault($default);
  35746. }
  35747. public function getShortcut()
  35748. {
  35749. return $this->shortcut;
  35750. }
  35751. public function getName()
  35752. {
  35753. return $this->name;
  35754. }
  35755. public function acceptValue()
  35756. {
  35757. return $this->isValueRequired() || $this->isValueOptional();
  35758. }
  35759. public function isValueRequired()
  35760. {
  35761. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  35762. }
  35763. public function isValueOptional()
  35764. {
  35765. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  35766. }
  35767. public function isArray()
  35768. {
  35769. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  35770. }
  35771. public function setDefault($default = null)
  35772. {
  35773. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  35774. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  35775. }
  35776. if ($this->isArray()) {
  35777. if (null === $default) {
  35778. $default = array();
  35779. } elseif (!is_array($default)) {
  35780. throw new LogicException('A default value for an array option must be an array.');
  35781. }
  35782. }
  35783. $this->default = $this->acceptValue() ? $default : false;
  35784. }
  35785. public function getDefault()
  35786. {
  35787. return $this->default;
  35788. }
  35789. public function getDescription()
  35790. {
  35791. return $this->description;
  35792. }
  35793. public function equals(InputOption $option)
  35794. {
  35795. return $option->getName() === $this->getName()
  35796. && $option->getShortcut() === $this->getShortcut()
  35797. && $option->getDefault() === $this->getDefault()
  35798. && $option->isArray() === $this->isArray()
  35799. && $option->isValueRequired() === $this->isValueRequired()
  35800. && $option->isValueOptional() === $this->isValueOptional()
  35801. ;
  35802. }
  35803. }
  35804. <?php
  35805. namespace Symfony\Component\Console\Input;
  35806. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35807. class StringInput extends ArgvInput
  35808. {
  35809. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  35810. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  35811. public function __construct($input, InputDefinition $definition = null)
  35812. {
  35813. if ($definition) {
  35814. @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);
  35815. }
  35816. parent::__construct(array(), null);
  35817. $this->setTokens($this->tokenize($input));
  35818. if (null !== $definition) {
  35819. $this->bind($definition);
  35820. }
  35821. }
  35822. private function tokenize($input)
  35823. {
  35824. $tokens = array();
  35825. $length = strlen($input);
  35826. $cursor = 0;
  35827. while ($cursor < $length) {
  35828. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  35829. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  35830. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
  35831. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  35832. $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
  35833. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  35834. $tokens[] = stripcslashes($match[1]);
  35835. } else {
  35836. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  35837. }
  35838. $cursor += strlen($match[0]);
  35839. }
  35840. return $tokens;
  35841. }
  35842. }
  35843. Copyright (c) 2004-2017 Fabien Potencier
  35844. Permission is hereby granted, free of charge, to any person obtaining a copy
  35845. of this software and associated documentation files (the "Software"), to deal
  35846. in the Software without restriction, including without limitation the rights
  35847. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  35848. copies of the Software, and to permit persons to whom the Software is furnished
  35849. to do so, subject to the following conditions:
  35850. The above copyright notice and this permission notice shall be included in all
  35851. copies or substantial portions of the Software.
  35852. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35853. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35854. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35855. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35856. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  35857. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  35858. THE SOFTWARE.
  35859. <?php
  35860. namespace Symfony\Component\Console\Logger;
  35861. use Psr\Log\AbstractLogger;
  35862. use Psr\Log\InvalidArgumentException;
  35863. use Psr\Log\LogLevel;
  35864. use Symfony\Component\Console\Output\OutputInterface;
  35865. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35866. class ConsoleLogger extends AbstractLogger
  35867. {
  35868. const INFO = 'info';
  35869. const ERROR = 'error';
  35870. private $output;
  35871. private $verbosityLevelMap = array(
  35872. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  35873. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  35874. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  35875. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  35876. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  35877. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  35878. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  35879. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  35880. );
  35881. private $formatLevelMap = array(
  35882. LogLevel::EMERGENCY => self::ERROR,
  35883. LogLevel::ALERT => self::ERROR,
  35884. LogLevel::CRITICAL => self::ERROR,
  35885. LogLevel::ERROR => self::ERROR,
  35886. LogLevel::WARNING => self::INFO,
  35887. LogLevel::NOTICE => self::INFO,
  35888. LogLevel::INFO => self::INFO,
  35889. LogLevel::DEBUG => self::INFO,
  35890. );
  35891. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  35892. {
  35893. $this->output = $output;
  35894. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  35895. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  35896. }
  35897. public function log($level, $message, array $context = array())
  35898. {
  35899. if (!isset($this->verbosityLevelMap[$level])) {
  35900. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  35901. }
  35902. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  35903. $output = $this->output->getErrorOutput();
  35904. } else {
  35905. $output = $this->output;
  35906. }
  35907. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  35908. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  35909. }
  35910. }
  35911. private function interpolate($message, array $context)
  35912. {
  35913. $replace = array();
  35914. foreach ($context as $key => $val) {
  35915. if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
  35916. $replace[sprintf('{%s}', $key)] = $val;
  35917. }
  35918. }
  35919. return strtr($message, $replace);
  35920. }
  35921. }
  35922. <?php
  35923. namespace Symfony\Component\Console\Output;
  35924. class BufferedOutput extends Output
  35925. {
  35926. private $buffer = '';
  35927. public function fetch()
  35928. {
  35929. $content = $this->buffer;
  35930. $this->buffer = '';
  35931. return $content;
  35932. }
  35933. protected function doWrite($message, $newline)
  35934. {
  35935. $this->buffer .= $message;
  35936. if ($newline) {
  35937. $this->buffer .= PHP_EOL;
  35938. }
  35939. }
  35940. }
  35941. <?php
  35942. namespace Symfony\Component\Console\Output;
  35943. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  35944. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  35945. {
  35946. private $stderr;
  35947. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  35948. {
  35949. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  35950. $actualDecorated = $this->isDecorated();
  35951. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  35952. if (null === $decorated) {
  35953. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  35954. }
  35955. }
  35956. public function setDecorated($decorated)
  35957. {
  35958. parent::setDecorated($decorated);
  35959. $this->stderr->setDecorated($decorated);
  35960. }
  35961. public function setFormatter(OutputFormatterInterface $formatter)
  35962. {
  35963. parent::setFormatter($formatter);
  35964. $this->stderr->setFormatter($formatter);
  35965. }
  35966. public function setVerbosity($level)
  35967. {
  35968. parent::setVerbosity($level);
  35969. $this->stderr->setVerbosity($level);
  35970. }
  35971. public function getErrorOutput()
  35972. {
  35973. return $this->stderr;
  35974. }
  35975. public function setErrorOutput(OutputInterface $error)
  35976. {
  35977. $this->stderr = $error;
  35978. }
  35979. protected function hasStdoutSupport()
  35980. {
  35981. return false === $this->isRunningOS400();
  35982. }
  35983. protected function hasStderrSupport()
  35984. {
  35985. return false === $this->isRunningOS400();
  35986. }
  35987. private function isRunningOS400()
  35988. {
  35989. $checks = array(
  35990. function_exists('php_uname') ? php_uname('s') : '',
  35991. getenv('OSTYPE'),
  35992. PHP_OS,
  35993. );
  35994. return false !== stripos(implode(';', $checks), 'OS400');
  35995. }
  35996. private function openOutputStream()
  35997. {
  35998. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  35999. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  36000. }
  36001. private function openErrorStream()
  36002. {
  36003. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  36004. return fopen($errorStream, 'w');
  36005. }
  36006. }
  36007. <?php
  36008. namespace Symfony\Component\Console\Output;
  36009. interface ConsoleOutputInterface extends OutputInterface
  36010. {
  36011. public function getErrorOutput();
  36012. public function setErrorOutput(OutputInterface $error);
  36013. }
  36014. <?php
  36015. namespace Symfony\Component\Console\Output;
  36016. use Symfony\Component\Console\Formatter\OutputFormatter;
  36017. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36018. class NullOutput implements OutputInterface
  36019. {
  36020. public function setFormatter(OutputFormatterInterface $formatter)
  36021. {
  36022. }
  36023. public function getFormatter()
  36024. {
  36025. return new OutputFormatter();
  36026. }
  36027. public function setDecorated($decorated)
  36028. {
  36029. }
  36030. public function isDecorated()
  36031. {
  36032. return false;
  36033. }
  36034. public function setVerbosity($level)
  36035. {
  36036. }
  36037. public function getVerbosity()
  36038. {
  36039. return self::VERBOSITY_QUIET;
  36040. }
  36041. public function isQuiet()
  36042. {
  36043. return true;
  36044. }
  36045. public function isVerbose()
  36046. {
  36047. return false;
  36048. }
  36049. public function isVeryVerbose()
  36050. {
  36051. return false;
  36052. }
  36053. public function isDebug()
  36054. {
  36055. return false;
  36056. }
  36057. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  36058. {
  36059. }
  36060. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  36061. {
  36062. }
  36063. }
  36064. <?php
  36065. namespace Symfony\Component\Console\Output;
  36066. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36067. use Symfony\Component\Console\Formatter\OutputFormatter;
  36068. abstract class Output implements OutputInterface
  36069. {
  36070. private $verbosity;
  36071. private $formatter;
  36072. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  36073. {
  36074. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  36075. $this->formatter = $formatter ?: new OutputFormatter();
  36076. $this->formatter->setDecorated($decorated);
  36077. }
  36078. public function setFormatter(OutputFormatterInterface $formatter)
  36079. {
  36080. $this->formatter = $formatter;
  36081. }
  36082. public function getFormatter()
  36083. {
  36084. return $this->formatter;
  36085. }
  36086. public function setDecorated($decorated)
  36087. {
  36088. $this->formatter->setDecorated($decorated);
  36089. }
  36090. public function isDecorated()
  36091. {
  36092. return $this->formatter->isDecorated();
  36093. }
  36094. public function setVerbosity($level)
  36095. {
  36096. $this->verbosity = (int) $level;
  36097. }
  36098. public function getVerbosity()
  36099. {
  36100. return $this->verbosity;
  36101. }
  36102. public function isQuiet()
  36103. {
  36104. return self::VERBOSITY_QUIET === $this->verbosity;
  36105. }
  36106. public function isVerbose()
  36107. {
  36108. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  36109. }
  36110. public function isVeryVerbose()
  36111. {
  36112. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  36113. }
  36114. public function isDebug()
  36115. {
  36116. return self::VERBOSITY_DEBUG <= $this->verbosity;
  36117. }
  36118. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  36119. {
  36120. $this->write($messages, true, $options);
  36121. }
  36122. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  36123. {
  36124. $messages = (array) $messages;
  36125. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  36126. $type = $types & $options ?: self::OUTPUT_NORMAL;
  36127. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  36128. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  36129. if ($verbosity > $this->getVerbosity()) {
  36130. return;
  36131. }
  36132. foreach ($messages as $message) {
  36133. switch ($type) {
  36134. case OutputInterface::OUTPUT_NORMAL:
  36135. $message = $this->formatter->format($message);
  36136. break;
  36137. case OutputInterface::OUTPUT_RAW:
  36138. break;
  36139. case OutputInterface::OUTPUT_PLAIN:
  36140. $message = strip_tags($this->formatter->format($message));
  36141. break;
  36142. }
  36143. $this->doWrite($message, $newline);
  36144. }
  36145. }
  36146. abstract protected function doWrite($message, $newline);
  36147. }
  36148. <?php
  36149. namespace Symfony\Component\Console\Output;
  36150. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36151. interface OutputInterface
  36152. {
  36153. const VERBOSITY_QUIET = 16;
  36154. const VERBOSITY_NORMAL = 32;
  36155. const VERBOSITY_VERBOSE = 64;
  36156. const VERBOSITY_VERY_VERBOSE = 128;
  36157. const VERBOSITY_DEBUG = 256;
  36158. const OUTPUT_NORMAL = 1;
  36159. const OUTPUT_RAW = 2;
  36160. const OUTPUT_PLAIN = 4;
  36161. public function write($messages, $newline = false, $options = 0);
  36162. public function writeln($messages, $options = 0);
  36163. public function setVerbosity($level);
  36164. public function getVerbosity();
  36165. public function setDecorated($decorated);
  36166. public function isDecorated();
  36167. public function setFormatter(OutputFormatterInterface $formatter);
  36168. public function getFormatter();
  36169. }
  36170. <?php
  36171. namespace Symfony\Component\Console\Output;
  36172. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36173. use Symfony\Component\Console\Exception\RuntimeException;
  36174. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36175. class StreamOutput extends Output
  36176. {
  36177. private $stream;
  36178. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  36179. {
  36180. if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  36181. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  36182. }
  36183. $this->stream = $stream;
  36184. if (null === $decorated) {
  36185. $decorated = $this->hasColorSupport();
  36186. }
  36187. parent::__construct($verbosity, $decorated, $formatter);
  36188. }
  36189. public function getStream()
  36190. {
  36191. return $this->stream;
  36192. }
  36193. protected function doWrite($message, $newline)
  36194. {
  36195. if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) {
  36196. throw new RuntimeException('Unable to write output.');
  36197. }
  36198. fflush($this->stream);
  36199. }
  36200. protected function hasColorSupport()
  36201. {
  36202. if (DIRECTORY_SEPARATOR === '\\') {
  36203. return
  36204. '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
  36205. || false !== getenv('ANSICON')
  36206. || 'ON' === getenv('ConEmuANSI')
  36207. || 'xterm' === getenv('TERM');
  36208. }
  36209. return function_exists('posix_isatty') && @posix_isatty($this->stream);
  36210. }
  36211. }
  36212. <?php
  36213. namespace Symfony\Component\Console\Question;
  36214. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36215. class ChoiceQuestion extends Question
  36216. {
  36217. private $choices;
  36218. private $multiselect = false;
  36219. private $prompt = ' > ';
  36220. private $errorMessage = 'Value "%s" is invalid';
  36221. public function __construct($question, array $choices, $default = null)
  36222. {
  36223. if (!$choices) {
  36224. throw new \LogicException('Choice question must have at least 1 choice available.');
  36225. }
  36226. parent::__construct($question, $default);
  36227. $this->choices = $choices;
  36228. $this->setValidator($this->getDefaultValidator());
  36229. $this->setAutocompleterValues($choices);
  36230. }
  36231. public function getChoices()
  36232. {
  36233. return $this->choices;
  36234. }
  36235. public function setMultiselect($multiselect)
  36236. {
  36237. $this->multiselect = $multiselect;
  36238. $this->setValidator($this->getDefaultValidator());
  36239. return $this;
  36240. }
  36241. public function isMultiselect()
  36242. {
  36243. return $this->multiselect;
  36244. }
  36245. public function getPrompt()
  36246. {
  36247. return $this->prompt;
  36248. }
  36249. public function setPrompt($prompt)
  36250. {
  36251. $this->prompt = $prompt;
  36252. return $this;
  36253. }
  36254. public function setErrorMessage($errorMessage)
  36255. {
  36256. $this->errorMessage = $errorMessage;
  36257. $this->setValidator($this->getDefaultValidator());
  36258. return $this;
  36259. }
  36260. private function getDefaultValidator()
  36261. {
  36262. $choices = $this->choices;
  36263. $errorMessage = $this->errorMessage;
  36264. $multiselect = $this->multiselect;
  36265. $isAssoc = $this->isAssoc($choices);
  36266. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  36267. $selectedChoices = str_replace(' ', '', $selected);
  36268. if ($multiselect) {
  36269. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  36270. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  36271. }
  36272. $selectedChoices = explode(',', $selectedChoices);
  36273. } else {
  36274. $selectedChoices = array($selected);
  36275. }
  36276. $multiselectChoices = array();
  36277. foreach ($selectedChoices as $value) {
  36278. $results = array();
  36279. foreach ($choices as $key => $choice) {
  36280. if ($choice === $value) {
  36281. $results[] = $key;
  36282. }
  36283. }
  36284. if (count($results) > 1) {
  36285. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  36286. }
  36287. $result = array_search($value, $choices);
  36288. if (!$isAssoc) {
  36289. if (false !== $result) {
  36290. $result = $choices[$result];
  36291. } elseif (isset($choices[$value])) {
  36292. $result = $choices[$value];
  36293. }
  36294. } elseif (false === $result && isset($choices[$value])) {
  36295. $result = $value;
  36296. }
  36297. if (false === $result) {
  36298. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  36299. }
  36300. $multiselectChoices[] = (string) $result;
  36301. }
  36302. if ($multiselect) {
  36303. return $multiselectChoices;
  36304. }
  36305. return current($multiselectChoices);
  36306. };
  36307. }
  36308. }
  36309. <?php
  36310. namespace Symfony\Component\Console\Question;
  36311. class ConfirmationQuestion extends Question
  36312. {
  36313. private $trueAnswerRegex;
  36314. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  36315. {
  36316. parent::__construct($question, (bool) $default);
  36317. $this->trueAnswerRegex = $trueAnswerRegex;
  36318. $this->setNormalizer($this->getDefaultNormalizer());
  36319. }
  36320. private function getDefaultNormalizer()
  36321. {
  36322. $default = $this->getDefault();
  36323. $regex = $this->trueAnswerRegex;
  36324. return function ($answer) use ($default, $regex) {
  36325. if (is_bool($answer)) {
  36326. return $answer;
  36327. }
  36328. $answerIsTrue = (bool) preg_match($regex, $answer);
  36329. if (false === $default) {
  36330. return $answer && $answerIsTrue;
  36331. }
  36332. return !$answer || $answerIsTrue;
  36333. };
  36334. }
  36335. }
  36336. <?php
  36337. namespace Symfony\Component\Console\Question;
  36338. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36339. use Symfony\Component\Console\Exception\LogicException;
  36340. class Question
  36341. {
  36342. private $question;
  36343. private $attempts;
  36344. private $hidden = false;
  36345. private $hiddenFallback = true;
  36346. private $autocompleterValues;
  36347. private $validator;
  36348. private $default;
  36349. private $normalizer;
  36350. public function __construct($question, $default = null)
  36351. {
  36352. $this->question = $question;
  36353. $this->default = $default;
  36354. }
  36355. public function getQuestion()
  36356. {
  36357. return $this->question;
  36358. }
  36359. public function getDefault()
  36360. {
  36361. return $this->default;
  36362. }
  36363. public function isHidden()
  36364. {
  36365. return $this->hidden;
  36366. }
  36367. public function setHidden($hidden)
  36368. {
  36369. if ($this->autocompleterValues) {
  36370. throw new LogicException('A hidden question cannot use the autocompleter.');
  36371. }
  36372. $this->hidden = (bool) $hidden;
  36373. return $this;
  36374. }
  36375. public function isHiddenFallback()
  36376. {
  36377. return $this->hiddenFallback;
  36378. }
  36379. public function setHiddenFallback($fallback)
  36380. {
  36381. $this->hiddenFallback = (bool) $fallback;
  36382. return $this;
  36383. }
  36384. public function getAutocompleterValues()
  36385. {
  36386. return $this->autocompleterValues;
  36387. }
  36388. public function setAutocompleterValues($values)
  36389. {
  36390. if (is_array($values)) {
  36391. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  36392. }
  36393. if (null !== $values && !is_array($values) && !$values instanceof \Traversable) {
  36394. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  36395. }
  36396. if ($this->hidden) {
  36397. throw new LogicException('A hidden question cannot use the autocompleter.');
  36398. }
  36399. $this->autocompleterValues = $values;
  36400. return $this;
  36401. }
  36402. public function setValidator($validator)
  36403. {
  36404. $this->validator = $validator;
  36405. return $this;
  36406. }
  36407. public function getValidator()
  36408. {
  36409. return $this->validator;
  36410. }
  36411. public function setMaxAttempts($attempts)
  36412. {
  36413. if (null !== $attempts && $attempts < 1) {
  36414. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  36415. }
  36416. $this->attempts = $attempts;
  36417. return $this;
  36418. }
  36419. public function getMaxAttempts()
  36420. {
  36421. return $this->attempts;
  36422. }
  36423. public function setNormalizer($normalizer)
  36424. {
  36425. $this->normalizer = $normalizer;
  36426. return $this;
  36427. }
  36428. public function getNormalizer()
  36429. {
  36430. return $this->normalizer;
  36431. }
  36432. protected function isAssoc($array)
  36433. {
  36434. return (bool) count(array_filter(array_keys($array), 'is_string'));
  36435. }
  36436. }
  36437. <?php
  36438. namespace Symfony\Component\Console;
  36439. use Symfony\Component\Console\Exception\RuntimeException;
  36440. use Symfony\Component\Console\Input\StringInput;
  36441. use Symfony\Component\Console\Output\ConsoleOutput;
  36442. use Symfony\Component\Process\ProcessBuilder;
  36443. use Symfony\Component\Process\PhpExecutableFinder;
  36444. class Shell
  36445. {
  36446. private $application;
  36447. private $history;
  36448. private $output;
  36449. private $hasReadline;
  36450. private $processIsolation = false;
  36451. public function __construct(Application $application)
  36452. {
  36453. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  36454. $this->hasReadline = function_exists('readline');
  36455. $this->application = $application;
  36456. $this->history = getenv('HOME').'/.history_'.$application->getName();
  36457. $this->output = new ConsoleOutput();
  36458. }
  36459. public function run()
  36460. {
  36461. $this->application->setAutoExit(false);
  36462. $this->application->setCatchExceptions(true);
  36463. if ($this->hasReadline) {
  36464. readline_read_history($this->history);
  36465. readline_completion_function(array($this, 'autocompleter'));
  36466. }
  36467. $this->output->writeln($this->getHeader());
  36468. $php = null;
  36469. if ($this->processIsolation) {
  36470. $finder = new PhpExecutableFinder();
  36471. $php = $finder->find();
  36472. $this->output->writeln(<<<'EOF'
  36473. <info>Running with process isolation, you should consider this:</info>
  36474. * each command is executed as separate process,
  36475. * commands don't support interactivity, all params must be passed explicitly,
  36476. * commands output is not colorized.
  36477. EOF
  36478. );
  36479. }
  36480. while (true) {
  36481. $command = $this->readline();
  36482. if (false === $command) {
  36483. $this->output->writeln("\n");
  36484. break;
  36485. }
  36486. if ($this->hasReadline) {
  36487. readline_add_history($command);
  36488. readline_write_history($this->history);
  36489. }
  36490. if ($this->processIsolation) {
  36491. $pb = new ProcessBuilder();
  36492. $process = $pb
  36493. ->add($php)
  36494. ->add($_SERVER['argv'][0])
  36495. ->add($command)
  36496. ->inheritEnvironmentVariables(true)
  36497. ->getProcess()
  36498. ;
  36499. $output = $this->output;
  36500. $process->run(function ($type, $data) use ($output) {
  36501. $output->writeln($data);
  36502. });
  36503. $ret = $process->getExitCode();
  36504. } else {
  36505. $ret = $this->application->run(new StringInput($command), $this->output);
  36506. }
  36507. if (0 !== $ret) {
  36508. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  36509. }
  36510. }
  36511. }
  36512. protected function getHeader()
  36513. {
  36514. return <<<EOF
  36515. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  36516. At the prompt, type <comment>help</comment> for some help,
  36517. or <comment>list</comment> to get a list of available commands.
  36518. To exit the shell, type <comment>^D</comment>.
  36519. EOF;
  36520. }
  36521. protected function getPrompt()
  36522. {
  36523. return $this->output->getFormatter()->format($this->application->getName().' > ');
  36524. }
  36525. protected function getOutput()
  36526. {
  36527. return $this->output;
  36528. }
  36529. protected function getApplication()
  36530. {
  36531. return $this->application;
  36532. }
  36533. private function autocompleter($text)
  36534. {
  36535. $info = readline_info();
  36536. $text = substr($info['line_buffer'], 0, $info['end']);
  36537. if ($info['point'] !== $info['end']) {
  36538. return true;
  36539. }
  36540. if (false === strpos($text, ' ') || !$text) {
  36541. return array_keys($this->application->all());
  36542. }
  36543. try {
  36544. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  36545. } catch (\Exception $e) {
  36546. return true;
  36547. }
  36548. $list = array('--help');
  36549. foreach ($command->getDefinition()->getOptions() as $option) {
  36550. $list[] = '--'.$option->getName();
  36551. }
  36552. return $list;
  36553. }
  36554. private function readline()
  36555. {
  36556. if ($this->hasReadline) {
  36557. $line = readline($this->getPrompt());
  36558. } else {
  36559. $this->output->write($this->getPrompt());
  36560. $line = fgets(STDIN, 1024);
  36561. $line = (false === $line || '' === $line) ? false : rtrim($line);
  36562. }
  36563. return $line;
  36564. }
  36565. public function getProcessIsolation()
  36566. {
  36567. return $this->processIsolation;
  36568. }
  36569. public function setProcessIsolation($processIsolation)
  36570. {
  36571. $this->processIsolation = (bool) $processIsolation;
  36572. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  36573. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  36574. }
  36575. }
  36576. }
  36577. <?php
  36578. namespace Symfony\Component\Console\Style;
  36579. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36580. use Symfony\Component\Console\Helper\ProgressBar;
  36581. use Symfony\Component\Console\Output\OutputInterface;
  36582. abstract class OutputStyle implements OutputInterface, StyleInterface
  36583. {
  36584. private $output;
  36585. public function __construct(OutputInterface $output)
  36586. {
  36587. $this->output = $output;
  36588. }
  36589. public function newLine($count = 1)
  36590. {
  36591. $this->output->write(str_repeat(PHP_EOL, $count));
  36592. }
  36593. public function createProgressBar($max = 0)
  36594. {
  36595. return new ProgressBar($this->output, $max);
  36596. }
  36597. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  36598. {
  36599. $this->output->write($messages, $newline, $type);
  36600. }
  36601. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  36602. {
  36603. $this->output->writeln($messages, $type);
  36604. }
  36605. public function setVerbosity($level)
  36606. {
  36607. $this->output->setVerbosity($level);
  36608. }
  36609. public function getVerbosity()
  36610. {
  36611. return $this->output->getVerbosity();
  36612. }
  36613. public function setDecorated($decorated)
  36614. {
  36615. $this->output->setDecorated($decorated);
  36616. }
  36617. public function isDecorated()
  36618. {
  36619. return $this->output->isDecorated();
  36620. }
  36621. public function setFormatter(OutputFormatterInterface $formatter)
  36622. {
  36623. $this->output->setFormatter($formatter);
  36624. }
  36625. public function getFormatter()
  36626. {
  36627. return $this->output->getFormatter();
  36628. }
  36629. }
  36630. <?php
  36631. namespace Symfony\Component\Console\Style;
  36632. interface StyleInterface
  36633. {
  36634. public function title($message);
  36635. public function section($message);
  36636. public function listing(array $elements);
  36637. public function text($message);
  36638. public function success($message);
  36639. public function error($message);
  36640. public function warning($message);
  36641. public function note($message);
  36642. public function caution($message);
  36643. public function table(array $headers, array $rows);
  36644. public function ask($question, $default = null, $validator = null);
  36645. public function askHidden($question, $validator = null);
  36646. public function confirm($question, $default = true);
  36647. public function choice($question, array $choices, $default = null);
  36648. public function newLine($count = 1);
  36649. public function progressStart($max = 0);
  36650. public function progressAdvance($step = 1);
  36651. public function progressFinish();
  36652. }
  36653. <?php
  36654. namespace Symfony\Component\Console\Style;
  36655. use Symfony\Component\Console\Application;
  36656. use Symfony\Component\Console\Exception\RuntimeException;
  36657. use Symfony\Component\Console\Formatter\OutputFormatter;
  36658. use Symfony\Component\Console\Helper\Helper;
  36659. use Symfony\Component\Console\Helper\ProgressBar;
  36660. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  36661. use Symfony\Component\Console\Helper\Table;
  36662. use Symfony\Component\Console\Input\InputInterface;
  36663. use Symfony\Component\Console\Output\BufferedOutput;
  36664. use Symfony\Component\Console\Output\OutputInterface;
  36665. use Symfony\Component\Console\Question\ChoiceQuestion;
  36666. use Symfony\Component\Console\Question\ConfirmationQuestion;
  36667. use Symfony\Component\Console\Question\Question;
  36668. class SymfonyStyle extends OutputStyle
  36669. {
  36670. const MAX_LINE_LENGTH = 120;
  36671. private $input;
  36672. private $questionHelper;
  36673. private $progressBar;
  36674. private $lineLength;
  36675. private $bufferedOutput;
  36676. public function __construct(InputInterface $input, OutputInterface $output)
  36677. {
  36678. $this->input = $input;
  36679. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  36680. $this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  36681. parent::__construct($output);
  36682. }
  36683. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  36684. {
  36685. $messages = is_array($messages) ? array_values($messages) : array($messages);
  36686. $this->autoPrependBlock();
  36687. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  36688. $this->newLine();
  36689. }
  36690. public function title($message)
  36691. {
  36692. $this->autoPrependBlock();
  36693. $this->writeln(array(
  36694. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  36695. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  36696. ));
  36697. $this->newLine();
  36698. }
  36699. public function section($message)
  36700. {
  36701. $this->autoPrependBlock();
  36702. $this->writeln(array(
  36703. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  36704. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  36705. ));
  36706. $this->newLine();
  36707. }
  36708. public function listing(array $elements)
  36709. {
  36710. $this->autoPrependText();
  36711. $elements = array_map(function ($element) {
  36712. return sprintf(' * %s', $element);
  36713. }, $elements);
  36714. $this->writeln($elements);
  36715. $this->newLine();
  36716. }
  36717. public function text($message)
  36718. {
  36719. $this->autoPrependText();
  36720. $messages = is_array($message) ? array_values($message) : array($message);
  36721. foreach ($messages as $message) {
  36722. $this->writeln(sprintf(' %s', $message));
  36723. }
  36724. }
  36725. public function comment($message)
  36726. {
  36727. $messages = is_array($message) ? array_values($message) : array($message);
  36728. $this->autoPrependBlock();
  36729. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  36730. $this->newLine();
  36731. }
  36732. public function success($message)
  36733. {
  36734. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  36735. }
  36736. public function error($message)
  36737. {
  36738. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  36739. }
  36740. public function warning($message)
  36741. {
  36742. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  36743. }
  36744. public function note($message)
  36745. {
  36746. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  36747. }
  36748. public function caution($message)
  36749. {
  36750. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  36751. }
  36752. public function table(array $headers, array $rows)
  36753. {
  36754. $style = clone Table::getStyleDefinition('symfony-style-guide');
  36755. $style->setCellHeaderFormat('<info>%s</info>');
  36756. $table = new Table($this);
  36757. $table->setHeaders($headers);
  36758. $table->setRows($rows);
  36759. $table->setStyle($style);
  36760. $table->render();
  36761. $this->newLine();
  36762. }
  36763. public function ask($question, $default = null, $validator = null)
  36764. {
  36765. $question = new Question($question, $default);
  36766. $question->setValidator($validator);
  36767. return $this->askQuestion($question);
  36768. }
  36769. public function askHidden($question, $validator = null)
  36770. {
  36771. $question = new Question($question);
  36772. $question->setHidden(true);
  36773. $question->setValidator($validator);
  36774. return $this->askQuestion($question);
  36775. }
  36776. public function confirm($question, $default = true)
  36777. {
  36778. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  36779. }
  36780. public function choice($question, array $choices, $default = null)
  36781. {
  36782. if (null !== $default) {
  36783. $values = array_flip($choices);
  36784. $default = $values[$default];
  36785. }
  36786. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  36787. }
  36788. public function progressStart($max = 0)
  36789. {
  36790. $this->progressBar = $this->createProgressBar($max);
  36791. $this->progressBar->start();
  36792. }
  36793. public function progressAdvance($step = 1)
  36794. {
  36795. $this->getProgressBar()->advance($step);
  36796. }
  36797. public function progressFinish()
  36798. {
  36799. $this->getProgressBar()->finish();
  36800. $this->newLine(2);
  36801. $this->progressBar = null;
  36802. }
  36803. public function createProgressBar($max = 0)
  36804. {
  36805. $progressBar = parent::createProgressBar($max);
  36806. if ('\\' !== DIRECTORY_SEPARATOR) {
  36807. $progressBar->setEmptyBarCharacter('â–‘');
  36808. $progressBar->setProgressCharacter('');
  36809. $progressBar->setBarCharacter('â–“');
  36810. }
  36811. return $progressBar;
  36812. }
  36813. public function askQuestion(Question $question)
  36814. {
  36815. if ($this->input->isInteractive()) {
  36816. $this->autoPrependBlock();
  36817. }
  36818. if (!$this->questionHelper) {
  36819. $this->questionHelper = new SymfonyQuestionHelper();
  36820. }
  36821. $answer = $this->questionHelper->ask($this->input, $this, $question);
  36822. if ($this->input->isInteractive()) {
  36823. $this->newLine();
  36824. $this->bufferedOutput->write("\n");
  36825. }
  36826. return $answer;
  36827. }
  36828. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  36829. {
  36830. parent::writeln($messages, $type);
  36831. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  36832. }
  36833. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  36834. {
  36835. parent::write($messages, $newline, $type);
  36836. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  36837. }
  36838. public function newLine($count = 1)
  36839. {
  36840. parent::newLine($count);
  36841. $this->bufferedOutput->write(str_repeat("\n", $count));
  36842. }
  36843. private function getProgressBar()
  36844. {
  36845. if (!$this->progressBar) {
  36846. throw new RuntimeException('The ProgressBar is not started.');
  36847. }
  36848. return $this->progressBar;
  36849. }
  36850. private function getTerminalWidth()
  36851. {
  36852. $application = new Application();
  36853. $dimensions = $application->getTerminalDimensions();
  36854. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  36855. }
  36856. private function autoPrependBlock()
  36857. {
  36858. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  36859. if (!isset($chars[0])) {
  36860. return $this->newLine();
  36861. }
  36862. $this->newLine(2 - substr_count($chars, "\n"));
  36863. }
  36864. private function autoPrependText()
  36865. {
  36866. $fetched = $this->bufferedOutput->fetch();
  36867. if ("\n" !== substr($fetched, -1)) {
  36868. $this->newLine();
  36869. }
  36870. }
  36871. private function reduceBuffer($messages)
  36872. {
  36873. return array_map(function ($value) {
  36874. return substr($value, -4);
  36875. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  36876. }
  36877. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  36878. {
  36879. $indentLength = 0;
  36880. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  36881. $lines = array();
  36882. if (null !== $type) {
  36883. $type = sprintf('[%s] ', $type);
  36884. $indentLength = strlen($type);
  36885. $lineIndentation = str_repeat(' ', $indentLength);
  36886. }
  36887. foreach ($messages as $key => $message) {
  36888. if ($escape) {
  36889. $message = OutputFormatter::escape($message);
  36890. }
  36891. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  36892. if (count($messages) > 1 && $key < count($messages) - 1) {
  36893. $lines[] = '';
  36894. }
  36895. }
  36896. $firstLineIndex = 0;
  36897. if ($padding && $this->isDecorated()) {
  36898. $firstLineIndex = 1;
  36899. array_unshift($lines, '');
  36900. $lines[] = '';
  36901. }
  36902. foreach ($lines as $i => &$line) {
  36903. if (null !== $type) {
  36904. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  36905. }
  36906. $line = $prefix.$line;
  36907. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  36908. if ($style) {
  36909. $line = sprintf('<%s>%s</>', $style, $line);
  36910. }
  36911. }
  36912. return $lines;
  36913. }
  36914. }
  36915. <?php
  36916. namespace Symfony\Component\Console\Tester;
  36917. use Symfony\Component\Console\Application;
  36918. use Symfony\Component\Console\Input\ArrayInput;
  36919. use Symfony\Component\Console\Input\InputInterface;
  36920. use Symfony\Component\Console\Output\OutputInterface;
  36921. use Symfony\Component\Console\Output\StreamOutput;
  36922. class ApplicationTester
  36923. {
  36924. private $application;
  36925. private $input;
  36926. private $output;
  36927. private $statusCode;
  36928. public function __construct(Application $application)
  36929. {
  36930. $this->application = $application;
  36931. }
  36932. public function run(array $input, $options = array())
  36933. {
  36934. $this->input = new ArrayInput($input);
  36935. if (isset($options['interactive'])) {
  36936. $this->input->setInteractive($options['interactive']);
  36937. }
  36938. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  36939. if (isset($options['decorated'])) {
  36940. $this->output->setDecorated($options['decorated']);
  36941. }
  36942. if (isset($options['verbosity'])) {
  36943. $this->output->setVerbosity($options['verbosity']);
  36944. }
  36945. return $this->statusCode = $this->application->run($this->input, $this->output);
  36946. }
  36947. public function getDisplay($normalize = false)
  36948. {
  36949. rewind($this->output->getStream());
  36950. $display = stream_get_contents($this->output->getStream());
  36951. if ($normalize) {
  36952. $display = str_replace(PHP_EOL, "\n", $display);
  36953. }
  36954. return $display;
  36955. }
  36956. public function getInput()
  36957. {
  36958. return $this->input;
  36959. }
  36960. public function getOutput()
  36961. {
  36962. return $this->output;
  36963. }
  36964. public function getStatusCode()
  36965. {
  36966. return $this->statusCode;
  36967. }
  36968. }
  36969. <?php
  36970. namespace Symfony\Component\Console\Tester;
  36971. use Symfony\Component\Console\Command\Command;
  36972. use Symfony\Component\Console\Input\ArrayInput;
  36973. use Symfony\Component\Console\Output\StreamOutput;
  36974. use Symfony\Component\Console\Input\InputInterface;
  36975. use Symfony\Component\Console\Output\OutputInterface;
  36976. class CommandTester
  36977. {
  36978. private $command;
  36979. private $input;
  36980. private $output;
  36981. private $statusCode;
  36982. public function __construct(Command $command)
  36983. {
  36984. $this->command = $command;
  36985. }
  36986. public function execute(array $input, array $options = array())
  36987. {
  36988. if (!isset($input['command'])
  36989. && (null !== $application = $this->command->getApplication())
  36990. && $application->getDefinition()->hasArgument('command')
  36991. ) {
  36992. $input = array_merge(array('command' => $this->command->getName()), $input);
  36993. }
  36994. $this->input = new ArrayInput($input);
  36995. if (isset($options['interactive'])) {
  36996. $this->input->setInteractive($options['interactive']);
  36997. }
  36998. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  36999. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  37000. if (isset($options['verbosity'])) {
  37001. $this->output->setVerbosity($options['verbosity']);
  37002. }
  37003. return $this->statusCode = $this->command->run($this->input, $this->output);
  37004. }
  37005. public function getDisplay($normalize = false)
  37006. {
  37007. rewind($this->output->getStream());
  37008. $display = stream_get_contents($this->output->getStream());
  37009. if ($normalize) {
  37010. $display = str_replace(PHP_EOL, "\n", $display);
  37011. }
  37012. return $display;
  37013. }
  37014. public function getInput()
  37015. {
  37016. return $this->input;
  37017. }
  37018. public function getOutput()
  37019. {
  37020. return $this->output;
  37021. }
  37022. public function getStatusCode()
  37023. {
  37024. return $this->statusCode;
  37025. }
  37026. }
  37027. <?php
  37028. namespace Symfony\Component\Debug;
  37029. use Psr\Log\AbstractLogger;
  37030. class BufferingLogger extends AbstractLogger
  37031. {
  37032. private $logs = array();
  37033. public function log($level, $message, array $context = array())
  37034. {
  37035. $this->logs[] = array($level, $message, $context);
  37036. }
  37037. public function cleanLogs()
  37038. {
  37039. $logs = $this->logs;
  37040. $this->logs = array();
  37041. return $logs;
  37042. }
  37043. }
  37044. <?php
  37045. namespace Symfony\Component\Debug;
  37046. class Debug
  37047. {
  37048. private static $enabled = false;
  37049. public static function enable($errorReportingLevel = null, $displayErrors = true)
  37050. {
  37051. if (static::$enabled) {
  37052. return;
  37053. }
  37054. static::$enabled = true;
  37055. if (null !== $errorReportingLevel) {
  37056. error_reporting($errorReportingLevel);
  37057. } else {
  37058. error_reporting(-1);
  37059. }
  37060. if ('cli' !== PHP_SAPI) {
  37061. ini_set('display_errors', 0);
  37062. ExceptionHandler::register();
  37063. } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
  37064. ini_set('display_errors', 1);
  37065. }
  37066. if ($displayErrors) {
  37067. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  37068. } else {
  37069. ErrorHandler::register()->throwAt(0, true);
  37070. }
  37071. DebugClassLoader::enable();
  37072. }
  37073. }
  37074. <?php
  37075. namespace Symfony\Component\Debug;
  37076. class DebugClassLoader
  37077. {
  37078. private $classLoader;
  37079. private $isFinder;
  37080. private $loaded = array();
  37081. private $wasFinder;
  37082. private static $caseCheck;
  37083. private static $deprecated = array();
  37084. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  37085. private static $darwinCache = array('/' => array('/', array()));
  37086. public function __construct($classLoader)
  37087. {
  37088. $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
  37089. if ($this->wasFinder) {
  37090. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  37091. $this->classLoader = array($classLoader, 'loadClass');
  37092. $this->isFinder = true;
  37093. } else {
  37094. $this->classLoader = $classLoader;
  37095. $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  37096. }
  37097. if (!isset(self::$caseCheck)) {
  37098. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
  37099. $i = strrpos($file, DIRECTORY_SEPARATOR);
  37100. $dir = substr($file, 0, 1 + $i);
  37101. $file = substr($file, 1 + $i);
  37102. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  37103. $test = realpath($dir.$test);
  37104. if (false === $test || false === $i) {
  37105. self::$caseCheck = 0;
  37106. } elseif (substr($test, -strlen($file)) === $file) {
  37107. self::$caseCheck = 1;
  37108. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  37109. self::$caseCheck = 2;
  37110. } else {
  37111. self::$caseCheck = 0;
  37112. }
  37113. }
  37114. }
  37115. public function getClassLoader()
  37116. {
  37117. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  37118. }
  37119. public static function enable()
  37120. {
  37121. class_exists('Symfony\Component\Debug\ErrorHandler');
  37122. class_exists('Psr\Log\LogLevel');
  37123. if (!is_array($functions = spl_autoload_functions())) {
  37124. return;
  37125. }
  37126. foreach ($functions as $function) {
  37127. spl_autoload_unregister($function);
  37128. }
  37129. foreach ($functions as $function) {
  37130. if (!is_array($function) || !$function[0] instanceof self) {
  37131. $function = array(new static($function), 'loadClass');
  37132. }
  37133. spl_autoload_register($function);
  37134. }
  37135. }
  37136. public static function disable()
  37137. {
  37138. if (!is_array($functions = spl_autoload_functions())) {
  37139. return;
  37140. }
  37141. foreach ($functions as $function) {
  37142. spl_autoload_unregister($function);
  37143. }
  37144. foreach ($functions as $function) {
  37145. if (is_array($function) && $function[0] instanceof self) {
  37146. $function = $function[0]->getClassLoader();
  37147. }
  37148. spl_autoload_register($function);
  37149. }
  37150. }
  37151. public function findFile($class)
  37152. {
  37153. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  37154. if ($this->wasFinder) {
  37155. return $this->classLoader[0]->findFile($class);
  37156. }
  37157. }
  37158. public function loadClass($class)
  37159. {
  37160. ErrorHandler::stackErrors();
  37161. try {
  37162. if ($this->isFinder && !isset($this->loaded[$class])) {
  37163. $this->loaded[$class] = true;
  37164. if ($file = $this->classLoader[0]->findFile($class)) {
  37165. require $file;
  37166. }
  37167. } else {
  37168. call_user_func($this->classLoader, $class);
  37169. $file = false;
  37170. }
  37171. } catch (\Exception $e) {
  37172. ErrorHandler::unstackErrors();
  37173. throw $e;
  37174. } catch (\Throwable $e) {
  37175. ErrorHandler::unstackErrors();
  37176. throw $e;
  37177. }
  37178. ErrorHandler::unstackErrors();
  37179. $exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  37180. if ($class && '\\' === $class[0]) {
  37181. $class = substr($class, 1);
  37182. }
  37183. if ($exists) {
  37184. $refl = new \ReflectionClass($class);
  37185. $name = $refl->getName();
  37186. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  37187. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  37188. }
  37189. if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  37190. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  37191. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  37192. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  37193. } else {
  37194. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  37195. $len = 0;
  37196. $ns = '';
  37197. } else {
  37198. $ns = substr($name, 0, $len);
  37199. }
  37200. $parent = get_parent_class($class);
  37201. if (!$parent || strncmp($ns, $parent, $len)) {
  37202. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  37203. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  37204. }
  37205. $parentInterfaces = array();
  37206. $deprecatedInterfaces = array();
  37207. if ($parent) {
  37208. foreach (class_implements($parent) as $interface) {
  37209. $parentInterfaces[$interface] = 1;
  37210. }
  37211. }
  37212. foreach ($refl->getInterfaceNames() as $interface) {
  37213. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  37214. $deprecatedInterfaces[] = $interface;
  37215. }
  37216. foreach (class_implements($interface) as $interface) {
  37217. $parentInterfaces[$interface] = 1;
  37218. }
  37219. }
  37220. foreach ($deprecatedInterfaces as $interface) {
  37221. if (!isset($parentInterfaces[$interface])) {
  37222. @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);
  37223. }
  37224. }
  37225. }
  37226. }
  37227. }
  37228. if ($file) {
  37229. if (!$exists) {
  37230. if (false !== strpos($class, '/')) {
  37231. 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));
  37232. }
  37233. 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));
  37234. }
  37235. if (self::$caseCheck) {
  37236. $real = explode('\\', $class.strrchr($file, '.'));
  37237. $tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file));
  37238. $i = count($tail) - 1;
  37239. $j = count($real) - 1;
  37240. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  37241. --$i;
  37242. --$j;
  37243. }
  37244. array_splice($tail, 0, $i + 1);
  37245. }
  37246. if (self::$caseCheck && $tail) {
  37247. $tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail);
  37248. $tailLen = strlen($tail);
  37249. $real = $refl->getFileName();
  37250. if (2 === self::$caseCheck) {
  37251. $i = 1 + strrpos($real, '/');
  37252. $file = substr($real, $i);
  37253. $real = substr($real, 0, $i);
  37254. if (isset(self::$darwinCache[$real])) {
  37255. $kDir = $real;
  37256. } else {
  37257. $kDir = strtolower($real);
  37258. if (isset(self::$darwinCache[$kDir])) {
  37259. $real = self::$darwinCache[$kDir][0];
  37260. } else {
  37261. $dir = getcwd();
  37262. chdir($real);
  37263. $real = getcwd().'/';
  37264. chdir($dir);
  37265. $dir = $real;
  37266. $k = $kDir;
  37267. $i = strlen($dir) - 1;
  37268. while (!isset(self::$darwinCache[$k])) {
  37269. self::$darwinCache[$k] = array($dir, array());
  37270. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  37271. while ('/' !== $dir[--$i]) {
  37272. }
  37273. $k = substr($k, 0, ++$i);
  37274. $dir = substr($dir, 0, $i--);
  37275. }
  37276. }
  37277. }
  37278. $dirFiles = self::$darwinCache[$kDir][1];
  37279. if (isset($dirFiles[$file])) {
  37280. $kFile = $file;
  37281. } else {
  37282. $kFile = strtolower($file);
  37283. if (!isset($dirFiles[$kFile])) {
  37284. foreach (scandir($real, 2) as $f) {
  37285. if ('.' !== $f[0]) {
  37286. $dirFiles[$f] = $f;
  37287. if ($f === $file) {
  37288. $kFile = $k = $file;
  37289. } elseif ($f !== $k = strtolower($f)) {
  37290. $dirFiles[$k] = $f;
  37291. }
  37292. }
  37293. }
  37294. self::$darwinCache[$kDir][1] = $dirFiles;
  37295. }
  37296. }
  37297. $real .= $dirFiles[$kFile];
  37298. }
  37299. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  37300. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  37301. ) {
  37302. 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)));
  37303. }
  37304. }
  37305. return true;
  37306. }
  37307. }
  37308. }
  37309. <?php
  37310. namespace Symfony\Component\Debug;
  37311. use Psr\Log\LogLevel;
  37312. use Psr\Log\LoggerInterface;
  37313. use Symfony\Component\Debug\Exception\ContextErrorException;
  37314. use Symfony\Component\Debug\Exception\FatalErrorException;
  37315. use Symfony\Component\Debug\Exception\FatalThrowableError;
  37316. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  37317. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  37318. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  37319. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  37320. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  37321. class ErrorHandler
  37322. {
  37323. const TYPE_DEPRECATION = -100;
  37324. private $levels = array(
  37325. E_DEPRECATED => 'Deprecated',
  37326. E_USER_DEPRECATED => 'User Deprecated',
  37327. E_NOTICE => 'Notice',
  37328. E_USER_NOTICE => 'User Notice',
  37329. E_STRICT => 'Runtime Notice',
  37330. E_WARNING => 'Warning',
  37331. E_USER_WARNING => 'User Warning',
  37332. E_COMPILE_WARNING => 'Compile Warning',
  37333. E_CORE_WARNING => 'Core Warning',
  37334. E_USER_ERROR => 'User Error',
  37335. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  37336. E_COMPILE_ERROR => 'Compile Error',
  37337. E_PARSE => 'Parse Error',
  37338. E_ERROR => 'Error',
  37339. E_CORE_ERROR => 'Core Error',
  37340. );
  37341. private $loggers = array(
  37342. E_DEPRECATED => array(null, LogLevel::INFO),
  37343. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  37344. E_NOTICE => array(null, LogLevel::WARNING),
  37345. E_USER_NOTICE => array(null, LogLevel::WARNING),
  37346. E_STRICT => array(null, LogLevel::WARNING),
  37347. E_WARNING => array(null, LogLevel::WARNING),
  37348. E_USER_WARNING => array(null, LogLevel::WARNING),
  37349. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  37350. E_CORE_WARNING => array(null, LogLevel::WARNING),
  37351. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  37352. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  37353. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  37354. E_PARSE => array(null, LogLevel::CRITICAL),
  37355. E_ERROR => array(null, LogLevel::CRITICAL),
  37356. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  37357. );
  37358. private $thrownErrors = 0x1FFF;
  37359. private $scopedErrors = 0x1FFF;
  37360. private $tracedErrors = 0x77FB;
  37361. private $screamedErrors = 0x55;
  37362. private $loggedErrors = 0;
  37363. private $loggedTraces = array();
  37364. private $isRecursive = 0;
  37365. private $isRoot = false;
  37366. private $exceptionHandler;
  37367. private $bootstrappingLogger;
  37368. private static $reservedMemory;
  37369. private static $stackedErrors = array();
  37370. private static $stackedErrorLevels = array();
  37371. private static $toStringException = null;
  37372. private static $exitCode = 0;
  37373. private $displayErrors = 0x1FFF;
  37374. public static function register($handler = null, $replace = true)
  37375. {
  37376. if (null === self::$reservedMemory) {
  37377. self::$reservedMemory = str_repeat('x', 10240);
  37378. register_shutdown_function(__CLASS__.'::handleFatalError');
  37379. }
  37380. $levels = -1;
  37381. if ($handlerIsNew = !$handler instanceof self) {
  37382. if (null !== $handler) {
  37383. $levels = $replace ? $handler : 0;
  37384. $replace = true;
  37385. }
  37386. $handler = new static();
  37387. }
  37388. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  37389. restore_error_handler();
  37390. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  37391. $handler->isRoot = true;
  37392. }
  37393. if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) {
  37394. $handler = $prev[0];
  37395. $replace = false;
  37396. }
  37397. if ($replace || !$prev) {
  37398. $handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException')));
  37399. } else {
  37400. restore_error_handler();
  37401. }
  37402. $handler->throwAt($levels & $handler->thrownErrors, true);
  37403. return $handler;
  37404. }
  37405. public function __construct(BufferingLogger $bootstrappingLogger = null)
  37406. {
  37407. if ($bootstrappingLogger) {
  37408. $this->bootstrappingLogger = $bootstrappingLogger;
  37409. $this->setDefaultLogger($bootstrappingLogger);
  37410. }
  37411. }
  37412. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  37413. {
  37414. $loggers = array();
  37415. if (is_array($levels)) {
  37416. foreach ($levels as $type => $logLevel) {
  37417. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  37418. $loggers[$type] = array($logger, $logLevel);
  37419. }
  37420. }
  37421. } else {
  37422. if (null === $levels) {
  37423. $levels = E_ALL | E_STRICT;
  37424. }
  37425. foreach ($this->loggers as $type => $log) {
  37426. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  37427. $log[0] = $logger;
  37428. $loggers[$type] = $log;
  37429. }
  37430. }
  37431. }
  37432. $this->setLoggers($loggers);
  37433. }
  37434. public function setLoggers(array $loggers)
  37435. {
  37436. $prevLogged = $this->loggedErrors;
  37437. $prev = $this->loggers;
  37438. $flush = array();
  37439. foreach ($loggers as $type => $log) {
  37440. if (!isset($prev[$type])) {
  37441. throw new \InvalidArgumentException('Unknown error type: '.$type);
  37442. }
  37443. if (!is_array($log)) {
  37444. $log = array($log);
  37445. } elseif (!array_key_exists(0, $log)) {
  37446. throw new \InvalidArgumentException('No logger provided');
  37447. }
  37448. if (null === $log[0]) {
  37449. $this->loggedErrors &= ~$type;
  37450. } elseif ($log[0] instanceof LoggerInterface) {
  37451. $this->loggedErrors |= $type;
  37452. } else {
  37453. throw new \InvalidArgumentException('Invalid logger provided');
  37454. }
  37455. $this->loggers[$type] = $log + $prev[$type];
  37456. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  37457. $flush[$type] = $type;
  37458. }
  37459. }
  37460. $this->reRegister($prevLogged | $this->thrownErrors);
  37461. if ($flush) {
  37462. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  37463. $type = $log[2]['type'];
  37464. if (!isset($flush[$type])) {
  37465. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  37466. } elseif ($this->loggers[$type][0]) {
  37467. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  37468. }
  37469. }
  37470. }
  37471. return $prev;
  37472. }
  37473. public function setExceptionHandler($handler)
  37474. {
  37475. if (null !== $handler && !is_callable($handler)) {
  37476. throw new \LogicException('The exception handler must be a valid PHP callable.');
  37477. }
  37478. $prev = $this->exceptionHandler;
  37479. $this->exceptionHandler = $handler;
  37480. return $prev;
  37481. }
  37482. public function throwAt($levels, $replace = false)
  37483. {
  37484. $prev = $this->thrownErrors;
  37485. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  37486. if (!$replace) {
  37487. $this->thrownErrors |= $prev;
  37488. }
  37489. $this->reRegister($prev | $this->loggedErrors);
  37490. $this->displayErrors = $this->thrownErrors;
  37491. return $prev;
  37492. }
  37493. public function scopeAt($levels, $replace = false)
  37494. {
  37495. $prev = $this->scopedErrors;
  37496. $this->scopedErrors = (int) $levels;
  37497. if (!$replace) {
  37498. $this->scopedErrors |= $prev;
  37499. }
  37500. return $prev;
  37501. }
  37502. public function traceAt($levels, $replace = false)
  37503. {
  37504. $prev = $this->tracedErrors;
  37505. $this->tracedErrors = (int) $levels;
  37506. if (!$replace) {
  37507. $this->tracedErrors |= $prev;
  37508. }
  37509. return $prev;
  37510. }
  37511. public function screamAt($levels, $replace = false)
  37512. {
  37513. $prev = $this->screamedErrors;
  37514. $this->screamedErrors = (int) $levels;
  37515. if (!$replace) {
  37516. $this->screamedErrors |= $prev;
  37517. }
  37518. return $prev;
  37519. }
  37520. private function reRegister($prev)
  37521. {
  37522. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  37523. $handler = set_error_handler('var_dump');
  37524. $handler = is_array($handler) ? $handler[0] : null;
  37525. restore_error_handler();
  37526. if ($handler === $this) {
  37527. restore_error_handler();
  37528. if ($this->isRoot) {
  37529. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  37530. } else {
  37531. set_error_handler(array($this, 'handleError'));
  37532. }
  37533. }
  37534. }
  37535. }
  37536. public function handleError($type, $message, $file, $line)
  37537. {
  37538. $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  37539. $log = $this->loggedErrors & $type;
  37540. $throw = $this->thrownErrors & $type & $level;
  37541. $type &= $level | $this->screamedErrors;
  37542. if (!$type || (!$log && !$throw)) {
  37543. return $type && $log;
  37544. }
  37545. $scope = $this->scopedErrors & $type;
  37546. if (4 < $numArgs = func_num_args()) {
  37547. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  37548. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  37549. } else {
  37550. $context = array();
  37551. $backtrace = null;
  37552. }
  37553. if (isset($context['GLOBALS']) && $scope) {
  37554. $e = $context;
  37555. unset($e['GLOBALS'], $context);
  37556. $context = $e;
  37557. }
  37558. if (null !== $backtrace && $type & E_ERROR) {
  37559. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  37560. return true;
  37561. }
  37562. if ($throw) {
  37563. if (null !== self::$toStringException) {
  37564. $throw = self::$toStringException;
  37565. self::$toStringException = null;
  37566. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  37567. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  37568. } else {
  37569. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  37570. }
  37571. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  37572. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  37573. }
  37574. if (E_USER_ERROR & $type) {
  37575. $backtrace = $backtrace ?: $throw->getTrace();
  37576. for ($i = 1; isset($backtrace[$i]); ++$i) {
  37577. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  37578. && '__toString' === $backtrace[$i]['function']
  37579. && '->' === $backtrace[$i]['type']
  37580. && !isset($backtrace[$i - 1]['class'])
  37581. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  37582. ) {
  37583. foreach ($context as $e) {
  37584. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  37585. if (1 === $i) {
  37586. $throw = $e;
  37587. break;
  37588. }
  37589. self::$toStringException = $e;
  37590. return true;
  37591. }
  37592. }
  37593. if (1 < $i) {
  37594. $this->handleException($throw);
  37595. return false;
  37596. }
  37597. }
  37598. }
  37599. }
  37600. throw $throw;
  37601. }
  37602. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  37603. $trace = true;
  37604. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  37605. $trace = false;
  37606. } else {
  37607. $this->loggedTraces[$e] = 1;
  37608. }
  37609. $e = compact('type', 'file', 'line', 'level');
  37610. if ($type & $level) {
  37611. if ($scope) {
  37612. $e['scope_vars'] = $context;
  37613. if ($trace) {
  37614. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  37615. }
  37616. } elseif ($trace) {
  37617. if (null === $backtrace) {
  37618. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  37619. } else {
  37620. foreach ($backtrace as &$frame) {
  37621. unset($frame['args'], $frame);
  37622. }
  37623. $e['stack'] = $backtrace;
  37624. }
  37625. }
  37626. }
  37627. if ($this->isRecursive) {
  37628. $log = 0;
  37629. } elseif (self::$stackedErrorLevels) {
  37630. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  37631. } else {
  37632. try {
  37633. $this->isRecursive = true;
  37634. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  37635. $this->isRecursive = false;
  37636. } catch (\Exception $e) {
  37637. $this->isRecursive = false;
  37638. throw $e;
  37639. } catch (\Throwable $e) {
  37640. $this->isRecursive = false;
  37641. throw $e;
  37642. }
  37643. }
  37644. return $type && $log;
  37645. }
  37646. public function handleException($exception, array $error = null)
  37647. {
  37648. if (null === $error) {
  37649. self::$exitCode = 255;
  37650. }
  37651. if (!$exception instanceof \Exception) {
  37652. $exception = new FatalThrowableError($exception);
  37653. }
  37654. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  37655. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  37656. $e = array(
  37657. 'type' => $type,
  37658. 'file' => $exception->getFile(),
  37659. 'line' => $exception->getLine(),
  37660. 'level' => error_reporting(),
  37661. 'stack' => $exception->getTrace(),
  37662. );
  37663. if ($exception instanceof FatalErrorException) {
  37664. if ($exception instanceof FatalThrowableError) {
  37665. $error = array(
  37666. 'type' => $type,
  37667. 'message' => $message = $exception->getMessage(),
  37668. 'file' => $e['file'],
  37669. 'line' => $e['line'],
  37670. );
  37671. } else {
  37672. $message = 'Fatal '.$exception->getMessage();
  37673. }
  37674. } elseif ($exception instanceof \ErrorException) {
  37675. $message = 'Uncaught '.$exception->getMessage();
  37676. if ($exception instanceof ContextErrorException) {
  37677. $e['context'] = $exception->getContext();
  37678. }
  37679. } else {
  37680. $message = 'Uncaught Exception: '.$exception->getMessage();
  37681. }
  37682. }
  37683. if ($this->loggedErrors & $type) {
  37684. try {
  37685. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  37686. } catch (\Exception $handlerException) {
  37687. } catch (\Throwable $handlerException) {
  37688. }
  37689. }
  37690. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  37691. foreach ($this->getFatalErrorHandlers() as $handler) {
  37692. if ($e = $handler->handleError($error, $exception)) {
  37693. $exception = $e;
  37694. break;
  37695. }
  37696. }
  37697. }
  37698. if (empty($this->exceptionHandler)) {
  37699. throw $exception;
  37700. }
  37701. try {
  37702. call_user_func($this->exceptionHandler, $exception);
  37703. } catch (\Exception $handlerException) {
  37704. } catch (\Throwable $handlerException) {
  37705. }
  37706. if (isset($handlerException)) {
  37707. $this->exceptionHandler = null;
  37708. $this->handleException($handlerException);
  37709. }
  37710. }
  37711. public static function handleFatalError(array $error = null)
  37712. {
  37713. if (null === self::$reservedMemory) {
  37714. return;
  37715. }
  37716. self::$reservedMemory = null;
  37717. $handler = set_error_handler('var_dump');
  37718. $handler = is_array($handler) ? $handler[0] : null;
  37719. restore_error_handler();
  37720. if (!$handler instanceof self) {
  37721. return;
  37722. }
  37723. if ($exit = null === $error) {
  37724. $error = error_get_last();
  37725. }
  37726. try {
  37727. while (self::$stackedErrorLevels) {
  37728. static::unstackErrors();
  37729. }
  37730. } catch (\Exception $exception) {
  37731. } catch (\Throwable $exception) {
  37732. }
  37733. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  37734. $handler->throwAt(0, true);
  37735. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  37736. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  37737. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  37738. } else {
  37739. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  37740. }
  37741. }
  37742. try {
  37743. if (isset($exception)) {
  37744. self::$exitCode = 255;
  37745. $handler->handleException($exception, $error);
  37746. }
  37747. } catch (FatalErrorException $e) {
  37748. }
  37749. if ($exit && self::$exitCode) {
  37750. $exitCode = self::$exitCode;
  37751. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  37752. }
  37753. }
  37754. public static function stackErrors()
  37755. {
  37756. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  37757. }
  37758. public static function unstackErrors()
  37759. {
  37760. $level = array_pop(self::$stackedErrorLevels);
  37761. if (null !== $level) {
  37762. $e = error_reporting($level);
  37763. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  37764. error_reporting($e);
  37765. }
  37766. }
  37767. if (empty(self::$stackedErrorLevels)) {
  37768. $errors = self::$stackedErrors;
  37769. self::$stackedErrors = array();
  37770. foreach ($errors as $e) {
  37771. $e[0]->log($e[1], $e[2], $e[3]);
  37772. }
  37773. }
  37774. }
  37775. protected function getFatalErrorHandlers()
  37776. {
  37777. return array(
  37778. new UndefinedFunctionFatalErrorHandler(),
  37779. new UndefinedMethodFatalErrorHandler(),
  37780. new ClassNotFoundFatalErrorHandler(),
  37781. );
  37782. }
  37783. public function setLevel($level)
  37784. {
  37785. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  37786. $level = null === $level ? error_reporting() : $level;
  37787. $this->throwAt($level, true);
  37788. }
  37789. public function setDisplayErrors($displayErrors)
  37790. {
  37791. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  37792. if ($displayErrors) {
  37793. $this->throwAt($this->displayErrors, true);
  37794. } else {
  37795. $displayErrors = $this->displayErrors;
  37796. $this->throwAt(0, true);
  37797. $this->displayErrors = $displayErrors;
  37798. }
  37799. }
  37800. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  37801. {
  37802. @trigger_error('The '.__METHOD__.' static method is deprecated since version 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
  37803. $handler = set_error_handler('var_dump');
  37804. $handler = is_array($handler) ? $handler[0] : null;
  37805. restore_error_handler();
  37806. if (!$handler instanceof self) {
  37807. return;
  37808. }
  37809. if ('deprecation' === $channel) {
  37810. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  37811. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  37812. } elseif ('scream' === $channel) {
  37813. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  37814. $handler->screamAt(E_ALL | E_STRICT);
  37815. } elseif ('emergency' === $channel) {
  37816. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  37817. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  37818. }
  37819. }
  37820. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  37821. {
  37822. $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());
  37823. return $this->handleError($level, $message, $file, $line, (array) $context);
  37824. }
  37825. public function handleFatal()
  37826. {
  37827. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
  37828. static::handleFatalError();
  37829. }
  37830. }
  37831. class ErrorHandlerCanary
  37832. {
  37833. private static $displayErrors = null;
  37834. public function __construct()
  37835. {
  37836. if (null === self::$displayErrors) {
  37837. self::$displayErrors = ini_set('display_errors', 1);
  37838. }
  37839. }
  37840. public function __destruct()
  37841. {
  37842. if (null !== self::$displayErrors) {
  37843. ini_set('display_errors', self::$displayErrors);
  37844. self::$displayErrors = null;
  37845. }
  37846. }
  37847. }
  37848. <?php
  37849. namespace Symfony\Component\Debug\Exception;
  37850. class ClassNotFoundException extends FatalErrorException
  37851. {
  37852. public function __construct($message, \ErrorException $previous)
  37853. {
  37854. parent::__construct(
  37855. $message,
  37856. $previous->getCode(),
  37857. $previous->getSeverity(),
  37858. $previous->getFile(),
  37859. $previous->getLine(),
  37860. $previous->getPrevious()
  37861. );
  37862. $this->setTrace($previous->getTrace());
  37863. }
  37864. }
  37865. <?php
  37866. namespace Symfony\Component\Debug\Exception;
  37867. class ContextErrorException extends \ErrorException
  37868. {
  37869. private $context = array();
  37870. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  37871. {
  37872. parent::__construct($message, $code, $severity, $filename, $lineno);
  37873. $this->context = $context;
  37874. }
  37875. public function getContext()
  37876. {
  37877. return $this->context;
  37878. }
  37879. }
  37880. <?php
  37881. namespace Symfony\Component\Debug\Exception;
  37882. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  37883. class DummyException extends \ErrorException
  37884. {
  37885. }
  37886. <?php
  37887. namespace Symfony\Component\HttpKernel\Exception;
  37888. class FatalErrorException extends \ErrorException
  37889. {
  37890. }
  37891. namespace Symfony\Component\Debug\Exception;
  37892. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  37893. class FatalErrorException extends LegacyFatalErrorException
  37894. {
  37895. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null)
  37896. {
  37897. parent::__construct($message, $code, $severity, $filename, $lineno);
  37898. if (null !== $trace) {
  37899. if (!$traceArgs) {
  37900. foreach ($trace as &$frame) {
  37901. unset($frame['args'], $frame['this'], $frame);
  37902. }
  37903. }
  37904. $this->setTrace($trace);
  37905. } elseif (null !== $traceOffset) {
  37906. if (function_exists('xdebug_get_function_stack')) {
  37907. $trace = xdebug_get_function_stack();
  37908. if (0 < $traceOffset) {
  37909. array_splice($trace, -$traceOffset);
  37910. }
  37911. foreach ($trace as &$frame) {
  37912. if (!isset($frame['type'])) {
  37913. if (isset($frame['class'])) {
  37914. $frame['type'] = '::';
  37915. }
  37916. } elseif ('dynamic' === $frame['type']) {
  37917. $frame['type'] = '->';
  37918. } elseif ('static' === $frame['type']) {
  37919. $frame['type'] = '::';
  37920. }
  37921. if (!$traceArgs) {
  37922. unset($frame['params'], $frame['args']);
  37923. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  37924. $frame['args'] = $frame['params'];
  37925. unset($frame['params']);
  37926. }
  37927. }
  37928. unset($frame);
  37929. $trace = array_reverse($trace);
  37930. } elseif (function_exists('symfony_debug_backtrace')) {
  37931. $trace = symfony_debug_backtrace();
  37932. if (0 < $traceOffset) {
  37933. array_splice($trace, 0, $traceOffset);
  37934. }
  37935. } else {
  37936. $trace = array();
  37937. }
  37938. $this->setTrace($trace);
  37939. }
  37940. }
  37941. protected function setTrace($trace)
  37942. {
  37943. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  37944. $traceReflector->setAccessible(true);
  37945. $traceReflector->setValue($this, $trace);
  37946. }
  37947. }
  37948. <?php
  37949. namespace Symfony\Component\Debug\Exception;
  37950. class FatalThrowableError extends FatalErrorException
  37951. {
  37952. public function __construct(\Throwable $e)
  37953. {
  37954. if ($e instanceof \ParseError) {
  37955. $message = 'Parse error: '.$e->getMessage();
  37956. $severity = E_PARSE;
  37957. } elseif ($e instanceof \TypeError) {
  37958. $message = 'Type error: '.$e->getMessage();
  37959. $severity = E_RECOVERABLE_ERROR;
  37960. } else {
  37961. $message = $e->getMessage();
  37962. $severity = E_ERROR;
  37963. }
  37964. \ErrorException::__construct(
  37965. $message,
  37966. $e->getCode(),
  37967. $severity,
  37968. $e->getFile(),
  37969. $e->getLine()
  37970. );
  37971. $this->setTrace($e->getTrace());
  37972. }
  37973. }
  37974. <?php
  37975. namespace Symfony\Component\HttpKernel\Exception;
  37976. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  37977. class FlattenException
  37978. {
  37979. private $handler;
  37980. public static function __callStatic($method, $args)
  37981. {
  37982. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  37983. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method));
  37984. }
  37985. return call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  37986. }
  37987. public function __call($method, $args)
  37988. {
  37989. if (!isset($this->handler)) {
  37990. $this->handler = new DebugFlattenException();
  37991. }
  37992. if (!method_exists($this->handler, $method)) {
  37993. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method));
  37994. }
  37995. return call_user_func_array(array($this->handler, $method), $args);
  37996. }
  37997. }
  37998. namespace Symfony\Component\Debug\Exception;
  37999. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  38000. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  38001. class FlattenException extends LegacyFlattenException
  38002. {
  38003. private $message;
  38004. private $code;
  38005. private $previous;
  38006. private $trace;
  38007. private $class;
  38008. private $statusCode;
  38009. private $headers;
  38010. private $file;
  38011. private $line;
  38012. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  38013. {
  38014. $e = new static();
  38015. $e->setMessage($exception->getMessage());
  38016. $e->setCode($exception->getCode());
  38017. if ($exception instanceof HttpExceptionInterface) {
  38018. $statusCode = $exception->getStatusCode();
  38019. $headers = array_merge($headers, $exception->getHeaders());
  38020. }
  38021. if (null === $statusCode) {
  38022. $statusCode = 500;
  38023. }
  38024. $e->setStatusCode($statusCode);
  38025. $e->setHeaders($headers);
  38026. $e->setTraceFromException($exception);
  38027. $e->setClass(get_class($exception));
  38028. $e->setFile($exception->getFile());
  38029. $e->setLine($exception->getLine());
  38030. $previous = $exception->getPrevious();
  38031. if ($previous instanceof \Exception) {
  38032. $e->setPrevious(static::create($previous));
  38033. } elseif ($previous instanceof \Throwable) {
  38034. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  38035. }
  38036. return $e;
  38037. }
  38038. public function toArray()
  38039. {
  38040. $exceptions = array();
  38041. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  38042. $exceptions[] = array(
  38043. 'message' => $exception->getMessage(),
  38044. 'class' => $exception->getClass(),
  38045. 'trace' => $exception->getTrace(),
  38046. );
  38047. }
  38048. return $exceptions;
  38049. }
  38050. public function getStatusCode()
  38051. {
  38052. return $this->statusCode;
  38053. }
  38054. public function setStatusCode($code)
  38055. {
  38056. $this->statusCode = $code;
  38057. }
  38058. public function getHeaders()
  38059. {
  38060. return $this->headers;
  38061. }
  38062. public function setHeaders(array $headers)
  38063. {
  38064. $this->headers = $headers;
  38065. }
  38066. public function getClass()
  38067. {
  38068. return $this->class;
  38069. }
  38070. public function setClass($class)
  38071. {
  38072. $this->class = $class;
  38073. }
  38074. public function getFile()
  38075. {
  38076. return $this->file;
  38077. }
  38078. public function setFile($file)
  38079. {
  38080. $this->file = $file;
  38081. }
  38082. public function getLine()
  38083. {
  38084. return $this->line;
  38085. }
  38086. public function setLine($line)
  38087. {
  38088. $this->line = $line;
  38089. }
  38090. public function getMessage()
  38091. {
  38092. return $this->message;
  38093. }
  38094. public function setMessage($message)
  38095. {
  38096. $this->message = $message;
  38097. }
  38098. public function getCode()
  38099. {
  38100. return $this->code;
  38101. }
  38102. public function setCode($code)
  38103. {
  38104. $this->code = $code;
  38105. }
  38106. public function getPrevious()
  38107. {
  38108. return $this->previous;
  38109. }
  38110. public function setPrevious(FlattenException $previous)
  38111. {
  38112. $this->previous = $previous;
  38113. }
  38114. public function getAllPrevious()
  38115. {
  38116. $exceptions = array();
  38117. $e = $this;
  38118. while ($e = $e->getPrevious()) {
  38119. $exceptions[] = $e;
  38120. }
  38121. return $exceptions;
  38122. }
  38123. public function getTrace()
  38124. {
  38125. return $this->trace;
  38126. }
  38127. public function setTraceFromException(\Exception $exception)
  38128. {
  38129. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  38130. }
  38131. public function setTrace($trace, $file, $line)
  38132. {
  38133. $this->trace = array();
  38134. $this->trace[] = array(
  38135. 'namespace' => '',
  38136. 'short_class' => '',
  38137. 'class' => '',
  38138. 'type' => '',
  38139. 'function' => '',
  38140. 'file' => $file,
  38141. 'line' => $line,
  38142. 'args' => array(),
  38143. );
  38144. foreach ($trace as $entry) {
  38145. $class = '';
  38146. $namespace = '';
  38147. if (isset($entry['class'])) {
  38148. $parts = explode('\\', $entry['class']);
  38149. $class = array_pop($parts);
  38150. $namespace = implode('\\', $parts);
  38151. }
  38152. $this->trace[] = array(
  38153. 'namespace' => $namespace,
  38154. 'short_class' => $class,
  38155. 'class' => isset($entry['class']) ? $entry['class'] : '',
  38156. 'type' => isset($entry['type']) ? $entry['type'] : '',
  38157. 'function' => isset($entry['function']) ? $entry['function'] : null,
  38158. 'file' => isset($entry['file']) ? $entry['file'] : null,
  38159. 'line' => isset($entry['line']) ? $entry['line'] : null,
  38160. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  38161. );
  38162. }
  38163. }
  38164. private function flattenArgs($args, $level = 0, &$count = 0)
  38165. {
  38166. $result = array();
  38167. foreach ($args as $key => $value) {
  38168. if (++$count > 1e4) {
  38169. return array('array', '*SKIPPED over 10000 entries*');
  38170. }
  38171. if ($value instanceof \__PHP_Incomplete_Class) {
  38172. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  38173. } elseif (is_object($value)) {
  38174. $result[$key] = array('object', get_class($value));
  38175. } elseif (is_array($value)) {
  38176. if ($level > 10) {
  38177. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  38178. } else {
  38179. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  38180. }
  38181. } elseif (null === $value) {
  38182. $result[$key] = array('null', null);
  38183. } elseif (is_bool($value)) {
  38184. $result[$key] = array('boolean', $value);
  38185. } elseif (is_resource($value)) {
  38186. $result[$key] = array('resource', get_resource_type($value));
  38187. } else {
  38188. $result[$key] = array('string', (string) $value);
  38189. }
  38190. }
  38191. return $result;
  38192. }
  38193. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  38194. {
  38195. $array = new \ArrayObject($value);
  38196. return $array['__PHP_Incomplete_Class_Name'];
  38197. }
  38198. }
  38199. <?php
  38200. namespace Symfony\Component\Debug\Exception;
  38201. class OutOfMemoryException extends FatalErrorException
  38202. {
  38203. }
  38204. <?php
  38205. namespace Symfony\Component\Debug\Exception;
  38206. class UndefinedFunctionException extends FatalErrorException
  38207. {
  38208. public function __construct($message, \ErrorException $previous)
  38209. {
  38210. parent::__construct(
  38211. $message,
  38212. $previous->getCode(),
  38213. $previous->getSeverity(),
  38214. $previous->getFile(),
  38215. $previous->getLine(),
  38216. $previous->getPrevious()
  38217. );
  38218. $this->setTrace($previous->getTrace());
  38219. }
  38220. }
  38221. <?php
  38222. namespace Symfony\Component\Debug\Exception;
  38223. class UndefinedMethodException extends FatalErrorException
  38224. {
  38225. public function __construct($message, \ErrorException $previous)
  38226. {
  38227. parent::__construct(
  38228. $message,
  38229. $previous->getCode(),
  38230. $previous->getSeverity(),
  38231. $previous->getFile(),
  38232. $previous->getLine(),
  38233. $previous->getPrevious()
  38234. );
  38235. $this->setTrace($previous->getTrace());
  38236. }
  38237. }
  38238. <?php
  38239. namespace Symfony\Component\Debug;
  38240. use Symfony\Component\HttpFoundation\Response;
  38241. use Symfony\Component\Debug\Exception\FlattenException;
  38242. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  38243. class ExceptionHandler
  38244. {
  38245. private $debug;
  38246. private $charset;
  38247. private $handler;
  38248. private $caughtBuffer;
  38249. private $caughtLength;
  38250. private $fileLinkFormat;
  38251. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  38252. {
  38253. if (false !== strpos($charset, '%')) {
  38254. @trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since version 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);
  38255. $pivot = $fileLinkFormat;
  38256. $fileLinkFormat = $charset;
  38257. $charset = $pivot;
  38258. }
  38259. $this->debug = $debug;
  38260. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  38261. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  38262. }
  38263. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  38264. {
  38265. $handler = new static($debug, $charset, $fileLinkFormat);
  38266. $prev = set_exception_handler(array($handler, 'handle'));
  38267. if (is_array($prev) && $prev[0] instanceof ErrorHandler) {
  38268. restore_exception_handler();
  38269. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  38270. }
  38271. return $handler;
  38272. }
  38273. public function setHandler($handler)
  38274. {
  38275. if (null !== $handler && !is_callable($handler)) {
  38276. throw new \LogicException('The exception handler must be a valid PHP callable.');
  38277. }
  38278. $old = $this->handler;
  38279. $this->handler = $handler;
  38280. return $old;
  38281. }
  38282. public function setFileLinkFormat($format)
  38283. {
  38284. $old = $this->fileLinkFormat;
  38285. $this->fileLinkFormat = $format;
  38286. return $old;
  38287. }
  38288. public function handle(\Exception $exception)
  38289. {
  38290. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  38291. $this->failSafeHandle($exception);
  38292. return;
  38293. }
  38294. $caughtLength = $this->caughtLength = 0;
  38295. ob_start(array($this, 'catchOutput'));
  38296. $this->failSafeHandle($exception);
  38297. while (null === $this->caughtBuffer && ob_end_flush()) {
  38298. }
  38299. if (isset($this->caughtBuffer[0])) {
  38300. ob_start(array($this, 'cleanOutput'));
  38301. echo $this->caughtBuffer;
  38302. $caughtLength = ob_get_length();
  38303. }
  38304. $this->caughtBuffer = null;
  38305. try {
  38306. call_user_func($this->handler, $exception);
  38307. $this->caughtLength = $caughtLength;
  38308. } catch (\Exception $e) {
  38309. if (!$caughtLength) {
  38310. throw $exception;
  38311. }
  38312. }
  38313. }
  38314. private function failSafeHandle(\Exception $exception)
  38315. {
  38316. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  38317. && __CLASS__ !== get_class($this)
  38318. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  38319. && __CLASS__ !== $reflector->class
  38320. ) {
  38321. $response = $this->createResponse($exception);
  38322. $response->sendHeaders();
  38323. $response->sendContent();
  38324. @trigger_error(sprintf("The %s::createResponse method is deprecated since 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
  38325. return;
  38326. }
  38327. $this->sendPhpResponse($exception);
  38328. }
  38329. public function sendPhpResponse($exception)
  38330. {
  38331. if (!$exception instanceof FlattenException) {
  38332. $exception = FlattenException::create($exception);
  38333. }
  38334. if (!headers_sent()) {
  38335. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  38336. foreach ($exception->getHeaders() as $name => $value) {
  38337. header($name.': '.$value, false);
  38338. }
  38339. header('Content-Type: text/html; charset='.$this->charset);
  38340. }
  38341. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  38342. }
  38343. public function createResponse($exception)
  38344. {
  38345. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38346. if (!$exception instanceof FlattenException) {
  38347. $exception = FlattenException::create($exception);
  38348. }
  38349. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  38350. }
  38351. public function getHtml($exception)
  38352. {
  38353. if (!$exception instanceof FlattenException) {
  38354. $exception = FlattenException::create($exception);
  38355. }
  38356. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  38357. }
  38358. public function getContent(FlattenException $exception)
  38359. {
  38360. switch ($exception->getStatusCode()) {
  38361. case 404:
  38362. $title = 'Sorry, the page you are looking for could not be found.';
  38363. break;
  38364. default:
  38365. $title = 'Whoops, looks like something went wrong.';
  38366. }
  38367. $content = '';
  38368. if ($this->debug) {
  38369. try {
  38370. $count = count($exception->getAllPrevious());
  38371. $total = $count + 1;
  38372. foreach ($exception->toArray() as $position => $e) {
  38373. $ind = $count - $position + 1;
  38374. $class = $this->formatClass($e['class']);
  38375. $message = nl2br($this->escapeHtml($e['message']));
  38376. $content .= sprintf(<<<'EOF'
  38377. <h2 class="block_exception clear_fix">
  38378. <span class="exception_counter">%d/%d</span>
  38379. <span class="exception_title">%s%s:</span>
  38380. <span class="exception_message">%s</span>
  38381. </h2>
  38382. <div class="block">
  38383. <ol class="traces list_exception">
  38384. EOF
  38385. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  38386. foreach ($e['trace'] as $trace) {
  38387. $content .= ' <li>';
  38388. if ($trace['function']) {
  38389. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  38390. }
  38391. if (isset($trace['file']) && isset($trace['line'])) {
  38392. $content .= $this->formatPath($trace['file'], $trace['line']);
  38393. }
  38394. $content .= "</li>\n";
  38395. }
  38396. $content .= " </ol>\n</div>\n";
  38397. }
  38398. } catch (\Exception $e) {
  38399. if ($this->debug) {
  38400. $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage()));
  38401. } else {
  38402. $title = 'Whoops, looks like something went wrong.';
  38403. }
  38404. }
  38405. }
  38406. return <<<EOF
  38407. <div id="sf-resetcontent" class="sf-reset">
  38408. <h1>$title</h1>
  38409. $content
  38410. </div>
  38411. EOF;
  38412. }
  38413. public function getStylesheet(FlattenException $exception)
  38414. {
  38415. return <<<'EOF'
  38416. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  38417. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  38418. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  38419. .sf-reset .clear_fix { display:inline-block; }
  38420. .sf-reset * html .clear_fix { height:1%; }
  38421. .sf-reset .clear_fix { display:block; }
  38422. .sf-reset, .sf-reset .block { margin: auto }
  38423. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  38424. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  38425. .sf-reset strong { font-weight:bold; }
  38426. .sf-reset a { color:#6c6159; cursor: default; }
  38427. .sf-reset a img { border:none; }
  38428. .sf-reset a:hover { text-decoration:underline; }
  38429. .sf-reset em { font-style:italic; }
  38430. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  38431. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  38432. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  38433. .sf-reset .exception_message { margin-left: 3em; display: block; }
  38434. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  38435. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  38436. -webkit-border-bottom-right-radius: 16px;
  38437. -webkit-border-bottom-left-radius: 16px;
  38438. -moz-border-radius-bottomright: 16px;
  38439. -moz-border-radius-bottomleft: 16px;
  38440. border-bottom-right-radius: 16px;
  38441. border-bottom-left-radius: 16px;
  38442. border-bottom:1px solid #ccc;
  38443. border-right:1px solid #ccc;
  38444. border-left:1px solid #ccc;
  38445. word-wrap: break-word;
  38446. }
  38447. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  38448. -webkit-border-top-left-radius: 16px;
  38449. -webkit-border-top-right-radius: 16px;
  38450. -moz-border-radius-topleft: 16px;
  38451. -moz-border-radius-topright: 16px;
  38452. border-top-left-radius: 16px;
  38453. border-top-right-radius: 16px;
  38454. border-top:1px solid #ccc;
  38455. border-right:1px solid #ccc;
  38456. border-left:1px solid #ccc;
  38457. overflow: hidden;
  38458. word-wrap: break-word;
  38459. }
  38460. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  38461. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  38462. .sf-reset ol { padding: 10px 0; }
  38463. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  38464. -webkit-border-radius: 10px;
  38465. -moz-border-radius: 10px;
  38466. border-radius: 10px;
  38467. border: 1px solid #ccc;
  38468. }
  38469. EOF;
  38470. }
  38471. private function decorate($content, $css)
  38472. {
  38473. return <<<EOF
  38474. <!DOCTYPE html>
  38475. <html>
  38476. <head>
  38477. <meta charset="{$this->charset}" />
  38478. <meta name="robots" content="noindex,nofollow" />
  38479. <style>
  38480. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  38481. 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;}
  38482. html { background: #eee; padding: 10px }
  38483. img { border: 0; }
  38484. #sf-resetcontent { width:970px; margin:0 auto; }
  38485. $css
  38486. </style>
  38487. </head>
  38488. <body>
  38489. $content
  38490. </body>
  38491. </html>
  38492. EOF;
  38493. }
  38494. private function formatClass($class)
  38495. {
  38496. $parts = explode('\\', $class);
  38497. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  38498. }
  38499. private function formatPath($path, $line)
  38500. {
  38501. $path = $this->escapeHtml($path);
  38502. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  38503. if ($linkFormat = $this->fileLinkFormat) {
  38504. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  38505. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  38506. }
  38507. 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);
  38508. }
  38509. private function formatArgs(array $args)
  38510. {
  38511. $result = array();
  38512. foreach ($args as $key => $item) {
  38513. if ('object' === $item[0]) {
  38514. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  38515. } elseif ('array' === $item[0]) {
  38516. $formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  38517. } elseif ('string' === $item[0]) {
  38518. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  38519. } elseif ('null' === $item[0]) {
  38520. $formattedValue = '<em>null</em>';
  38521. } elseif ('boolean' === $item[0]) {
  38522. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  38523. } elseif ('resource' === $item[0]) {
  38524. $formattedValue = '<em>resource</em>';
  38525. } else {
  38526. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  38527. }
  38528. $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  38529. }
  38530. return implode(', ', $result);
  38531. }
  38532. protected static function utf8Htmlize($str)
  38533. {
  38534. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  38535. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  38536. }
  38537. private function escapeHtml($str)
  38538. {
  38539. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  38540. }
  38541. public function catchOutput($buffer)
  38542. {
  38543. $this->caughtBuffer = $buffer;
  38544. return '';
  38545. }
  38546. public function cleanOutput($buffer)
  38547. {
  38548. if ($this->caughtLength) {
  38549. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  38550. if (isset($cleanBuffer[0])) {
  38551. $buffer = $cleanBuffer;
  38552. }
  38553. }
  38554. return $buffer;
  38555. }
  38556. }
  38557. <?php
  38558. namespace Symfony\Component\Debug\FatalErrorHandler;
  38559. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  38560. use Symfony\Component\Debug\Exception\FatalErrorException;
  38561. use Symfony\Component\Debug\DebugClassLoader;
  38562. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  38563. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  38564. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  38565. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  38566. {
  38567. public function handleError(array $error, FatalErrorException $exception)
  38568. {
  38569. $messageLen = strlen($error['message']);
  38570. $notFoundSuffix = '\' not found';
  38571. $notFoundSuffixLen = strlen($notFoundSuffix);
  38572. if ($notFoundSuffixLen > $messageLen) {
  38573. return;
  38574. }
  38575. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  38576. return;
  38577. }
  38578. foreach (array('class', 'interface', 'trait') as $typeName) {
  38579. $prefix = ucfirst($typeName).' \'';
  38580. $prefixLen = strlen($prefix);
  38581. if (0 !== strpos($error['message'], $prefix)) {
  38582. continue;
  38583. }
  38584. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  38585. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  38586. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  38587. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  38588. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  38589. $tail = ' for another namespace?';
  38590. } else {
  38591. $className = $fullyQualifiedClassName;
  38592. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  38593. $tail = '?';
  38594. }
  38595. if ($candidates = $this->getClassCandidates($className)) {
  38596. $tail = array_pop($candidates).'"?';
  38597. if ($candidates) {
  38598. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  38599. } else {
  38600. $tail = ' for "'.$tail;
  38601. }
  38602. }
  38603. $message .= "\nDid you forget a \"use\" statement".$tail;
  38604. return new ClassNotFoundException($message, $exception);
  38605. }
  38606. }
  38607. private function getClassCandidates($class)
  38608. {
  38609. if (!is_array($functions = spl_autoload_functions())) {
  38610. return array();
  38611. }
  38612. $classes = array();
  38613. foreach ($functions as $function) {
  38614. if (!is_array($function)) {
  38615. continue;
  38616. }
  38617. if ($function[0] instanceof DebugClassLoader) {
  38618. $function = $function[0]->getClassLoader();
  38619. if (is_object($function)) {
  38620. $function = array($function);
  38621. }
  38622. if (!is_array($function)) {
  38623. continue;
  38624. }
  38625. }
  38626. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  38627. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  38628. foreach ($paths as $path) {
  38629. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  38630. }
  38631. }
  38632. }
  38633. if ($function[0] instanceof ComposerClassLoader) {
  38634. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  38635. foreach ($paths as $path) {
  38636. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  38637. }
  38638. }
  38639. }
  38640. }
  38641. return array_unique($classes);
  38642. }
  38643. private function findClassInPath($path, $class, $prefix)
  38644. {
  38645. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  38646. return array();
  38647. }
  38648. $classes = array();
  38649. $filename = $class.'.php';
  38650. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  38651. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  38652. $classes[] = $class;
  38653. }
  38654. }
  38655. return $classes;
  38656. }
  38657. private function convertFileToClass($path, $file, $prefix)
  38658. {
  38659. $candidates = array(
  38660. $namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  38661. $prefix.$namespacedClass,
  38662. $prefix.'\\'.$namespacedClass,
  38663. str_replace('\\', '_', $namespacedClass),
  38664. str_replace('\\', '_', $prefix.$namespacedClass),
  38665. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  38666. );
  38667. if ($prefix) {
  38668. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  38669. }
  38670. foreach ($candidates as $candidate) {
  38671. if ($this->classExists($candidate)) {
  38672. return $candidate;
  38673. }
  38674. }
  38675. require_once $file;
  38676. foreach ($candidates as $candidate) {
  38677. if ($this->classExists($candidate)) {
  38678. return $candidate;
  38679. }
  38680. }
  38681. }
  38682. private function classExists($class)
  38683. {
  38684. return class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  38685. }
  38686. }
  38687. <?php
  38688. namespace Symfony\Component\Debug\FatalErrorHandler;
  38689. use Symfony\Component\Debug\Exception\FatalErrorException;
  38690. interface FatalErrorHandlerInterface
  38691. {
  38692. public function handleError(array $error, FatalErrorException $exception);
  38693. }
  38694. <?php
  38695. namespace Symfony\Component\Debug\FatalErrorHandler;
  38696. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  38697. use Symfony\Component\Debug\Exception\FatalErrorException;
  38698. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  38699. {
  38700. public function handleError(array $error, FatalErrorException $exception)
  38701. {
  38702. $messageLen = strlen($error['message']);
  38703. $notFoundSuffix = '()';
  38704. $notFoundSuffixLen = strlen($notFoundSuffix);
  38705. if ($notFoundSuffixLen > $messageLen) {
  38706. return;
  38707. }
  38708. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  38709. return;
  38710. }
  38711. $prefix = 'Call to undefined function ';
  38712. $prefixLen = strlen($prefix);
  38713. if (0 !== strpos($error['message'], $prefix)) {
  38714. return;
  38715. }
  38716. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  38717. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  38718. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  38719. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  38720. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  38721. } else {
  38722. $functionName = $fullyQualifiedFunctionName;
  38723. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  38724. }
  38725. $candidates = array();
  38726. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  38727. foreach ($definedFunctionNames as $definedFunctionName) {
  38728. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  38729. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  38730. } else {
  38731. $definedFunctionNameBasename = $definedFunctionName;
  38732. }
  38733. if ($definedFunctionNameBasename === $functionName) {
  38734. $candidates[] = '\\'.$definedFunctionName;
  38735. }
  38736. }
  38737. }
  38738. if ($candidates) {
  38739. sort($candidates);
  38740. $last = array_pop($candidates).'"?';
  38741. if ($candidates) {
  38742. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  38743. } else {
  38744. $candidates = '"'.$last;
  38745. }
  38746. $message .= "\nDid you mean to call ".$candidates;
  38747. }
  38748. return new UndefinedFunctionException($message, $exception);
  38749. }
  38750. }
  38751. <?php
  38752. namespace Symfony\Component\Debug\FatalErrorHandler;
  38753. use Symfony\Component\Debug\Exception\FatalErrorException;
  38754. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  38755. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  38756. {
  38757. public function handleError(array $error, FatalErrorException $exception)
  38758. {
  38759. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  38760. if (!$matches) {
  38761. return;
  38762. }
  38763. $className = $matches[1];
  38764. $methodName = $matches[2];
  38765. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  38766. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  38767. return new UndefinedMethodException($message, $exception);
  38768. }
  38769. $candidates = array();
  38770. foreach ($methods as $definedMethodName) {
  38771. $lev = levenshtein($methodName, $definedMethodName);
  38772. if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  38773. $candidates[] = $definedMethodName;
  38774. }
  38775. }
  38776. if ($candidates) {
  38777. sort($candidates);
  38778. $last = array_pop($candidates).'"?';
  38779. if ($candidates) {
  38780. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  38781. } else {
  38782. $candidates = '"'.$last;
  38783. }
  38784. $message .= "\nDid you mean to call ".$candidates;
  38785. }
  38786. return new UndefinedMethodException($message, $exception);
  38787. }
  38788. }
  38789. Copyright (c) 2004-2017 Fabien Potencier
  38790. Permission is hereby granted, free of charge, to any person obtaining a copy
  38791. of this software and associated documentation files (the "Software"), to deal
  38792. in the Software without restriction, including without limitation the rights
  38793. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  38794. copies of the Software, and to permit persons to whom the Software is furnished
  38795. to do so, subject to the following conditions:
  38796. The above copyright notice and this permission notice shall be included in all
  38797. copies or substantial portions of the Software.
  38798. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  38799. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  38800. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  38801. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38802. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  38803. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  38804. THE SOFTWARE.
  38805. <?php
  38806. namespace Symfony\Component\Filesystem\Exception;
  38807. interface ExceptionInterface
  38808. {
  38809. }
  38810. <?php
  38811. namespace Symfony\Component\Filesystem\Exception;
  38812. class FileNotFoundException extends IOException
  38813. {
  38814. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  38815. {
  38816. if (null === $message) {
  38817. if (null === $path) {
  38818. $message = 'File could not be found.';
  38819. } else {
  38820. $message = sprintf('File "%s" could not be found.', $path);
  38821. }
  38822. }
  38823. parent::__construct($message, $code, $previous, $path);
  38824. }
  38825. }
  38826. <?php
  38827. namespace Symfony\Component\Filesystem\Exception;
  38828. class IOException extends \RuntimeException implements IOExceptionInterface
  38829. {
  38830. private $path;
  38831. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  38832. {
  38833. $this->path = $path;
  38834. parent::__construct($message, $code, $previous);
  38835. }
  38836. public function getPath()
  38837. {
  38838. return $this->path;
  38839. }
  38840. }
  38841. <?php
  38842. namespace Symfony\Component\Filesystem\Exception;
  38843. interface IOExceptionInterface extends ExceptionInterface
  38844. {
  38845. public function getPath();
  38846. }
  38847. <?php
  38848. namespace Symfony\Component\Filesystem;
  38849. use Symfony\Component\Filesystem\Exception\IOException;
  38850. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  38851. class Filesystem
  38852. {
  38853. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  38854. {
  38855. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  38856. if ($originIsLocal && !is_file($originFile)) {
  38857. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  38858. }
  38859. $this->mkdir(dirname($targetFile));
  38860. $doCopy = true;
  38861. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  38862. $doCopy = filemtime($originFile) > filemtime($targetFile);
  38863. }
  38864. if ($doCopy) {
  38865. if (false === $source = @fopen($originFile, 'r')) {
  38866. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  38867. }
  38868. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  38869. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  38870. }
  38871. $bytesCopied = stream_copy_to_stream($source, $target);
  38872. fclose($source);
  38873. fclose($target);
  38874. unset($source, $target);
  38875. if (!is_file($targetFile)) {
  38876. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  38877. }
  38878. if ($originIsLocal) {
  38879. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  38880. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  38881. 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);
  38882. }
  38883. }
  38884. }
  38885. }
  38886. public function mkdir($dirs, $mode = 0777)
  38887. {
  38888. foreach ($this->toIterator($dirs) as $dir) {
  38889. if (is_dir($dir)) {
  38890. continue;
  38891. }
  38892. if (true !== @mkdir($dir, $mode, true)) {
  38893. $error = error_get_last();
  38894. if (!is_dir($dir)) {
  38895. if ($error) {
  38896. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, $error['message']), 0, null, $dir);
  38897. }
  38898. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  38899. }
  38900. }
  38901. }
  38902. }
  38903. public function exists($files)
  38904. {
  38905. $maxPathLength = PHP_MAXPATHLEN - 2;
  38906. foreach ($this->toIterator($files) as $file) {
  38907. if (strlen($file) > $maxPathLength) {
  38908. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  38909. }
  38910. if (!file_exists($file)) {
  38911. return false;
  38912. }
  38913. }
  38914. return true;
  38915. }
  38916. public function touch($files, $time = null, $atime = null)
  38917. {
  38918. foreach ($this->toIterator($files) as $file) {
  38919. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  38920. if (true !== $touch) {
  38921. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  38922. }
  38923. }
  38924. }
  38925. public function remove($files)
  38926. {
  38927. if ($files instanceof \Traversable) {
  38928. $files = iterator_to_array($files, false);
  38929. } elseif (!is_array($files)) {
  38930. $files = array($files);
  38931. }
  38932. $files = array_reverse($files);
  38933. foreach ($files as $file) {
  38934. if (is_link($file)) {
  38935. if (!@(unlink($file) || '\\' !== DIRECTORY_SEPARATOR || rmdir($file)) && file_exists($file)) {
  38936. $error = error_get_last();
  38937. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, $error['message']));
  38938. }
  38939. } elseif (is_dir($file)) {
  38940. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  38941. if (!@rmdir($file) && file_exists($file)) {
  38942. $error = error_get_last();
  38943. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, $error['message']));
  38944. }
  38945. } elseif (!@unlink($file) && file_exists($file)) {
  38946. $error = error_get_last();
  38947. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, $error['message']));
  38948. }
  38949. }
  38950. }
  38951. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  38952. {
  38953. foreach ($this->toIterator($files) as $file) {
  38954. if (true !== @chmod($file, $mode & ~$umask)) {
  38955. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  38956. }
  38957. if ($recursive && is_dir($file) && !is_link($file)) {
  38958. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  38959. }
  38960. }
  38961. }
  38962. public function chown($files, $user, $recursive = false)
  38963. {
  38964. foreach ($this->toIterator($files) as $file) {
  38965. if ($recursive && is_dir($file) && !is_link($file)) {
  38966. $this->chown(new \FilesystemIterator($file), $user, true);
  38967. }
  38968. if (is_link($file) && function_exists('lchown')) {
  38969. if (true !== @lchown($file, $user)) {
  38970. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  38971. }
  38972. } else {
  38973. if (true !== @chown($file, $user)) {
  38974. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  38975. }
  38976. }
  38977. }
  38978. }
  38979. public function chgrp($files, $group, $recursive = false)
  38980. {
  38981. foreach ($this->toIterator($files) as $file) {
  38982. if ($recursive && is_dir($file) && !is_link($file)) {
  38983. $this->chgrp(new \FilesystemIterator($file), $group, true);
  38984. }
  38985. if (is_link($file) && function_exists('lchgrp')) {
  38986. if (true !== @lchgrp($file, $group) || (defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  38987. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  38988. }
  38989. } else {
  38990. if (true !== @chgrp($file, $group)) {
  38991. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  38992. }
  38993. }
  38994. }
  38995. }
  38996. public function rename($origin, $target, $overwrite = false)
  38997. {
  38998. if (!$overwrite && $this->isReadable($target)) {
  38999. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  39000. }
  39001. if (true !== @rename($origin, $target)) {
  39002. if (is_dir($origin)) {
  39003. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  39004. $this->remove($origin);
  39005. return;
  39006. }
  39007. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  39008. }
  39009. }
  39010. private function isReadable($filename)
  39011. {
  39012. $maxPathLength = PHP_MAXPATHLEN - 2;
  39013. if (strlen($filename) > $maxPathLength) {
  39014. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  39015. }
  39016. return is_readable($filename);
  39017. }
  39018. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  39019. {
  39020. if ('\\' === DIRECTORY_SEPARATOR) {
  39021. $originDir = strtr($originDir, '/', '\\');
  39022. $targetDir = strtr($targetDir, '/', '\\');
  39023. if ($copyOnWindows) {
  39024. $this->mirror($originDir, $targetDir);
  39025. return;
  39026. }
  39027. }
  39028. $this->mkdir(dirname($targetDir));
  39029. $ok = false;
  39030. if (is_link($targetDir)) {
  39031. if (readlink($targetDir) != $originDir) {
  39032. $this->remove($targetDir);
  39033. } else {
  39034. $ok = true;
  39035. }
  39036. }
  39037. if (!$ok && true !== @symlink($originDir, $targetDir)) {
  39038. $report = error_get_last();
  39039. if (is_array($report)) {
  39040. if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) {
  39041. 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);
  39042. }
  39043. }
  39044. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  39045. }
  39046. }
  39047. public function makePathRelative($endPath, $startPath)
  39048. {
  39049. if ('\\' === DIRECTORY_SEPARATOR) {
  39050. $endPath = str_replace('\\', '/', $endPath);
  39051. $startPath = str_replace('\\', '/', $startPath);
  39052. }
  39053. $stripDriveLetter = function ($path) {
  39054. if (strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  39055. return substr($path, 2);
  39056. }
  39057. return $path;
  39058. };
  39059. $endPath = $stripDriveLetter($endPath);
  39060. $startPath = $stripDriveLetter($startPath);
  39061. $startPathArr = explode('/', trim($startPath, '/'));
  39062. $endPathArr = explode('/', trim($endPath, '/'));
  39063. $normalizePathArray = function ($pathSegments, $absolute) {
  39064. $result = array();
  39065. foreach ($pathSegments as $segment) {
  39066. if ('..' === $segment && ($absolute || count($result))) {
  39067. array_pop($result);
  39068. } elseif ('.' !== $segment) {
  39069. $result[] = $segment;
  39070. }
  39071. }
  39072. return $result;
  39073. };
  39074. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  39075. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  39076. $index = 0;
  39077. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  39078. ++$index;
  39079. }
  39080. if (1 === count($startPathArr) && '' === $startPathArr[0]) {
  39081. $depth = 0;
  39082. } else {
  39083. $depth = count($startPathArr) - $index;
  39084. }
  39085. $traverser = str_repeat('../', $depth);
  39086. $endPathRemainder = implode('/', array_slice($endPathArr, $index));
  39087. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  39088. return '' === $relativePath ? './' : $relativePath;
  39089. }
  39090. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  39091. {
  39092. $targetDir = rtrim($targetDir, '/\\');
  39093. $originDir = rtrim($originDir, '/\\');
  39094. $originDirLen = strlen($originDir);
  39095. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  39096. $deleteIterator = $iterator;
  39097. if (null === $deleteIterator) {
  39098. $flags = \FilesystemIterator::SKIP_DOTS;
  39099. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  39100. }
  39101. $targetDirLen = strlen($targetDir);
  39102. foreach ($deleteIterator as $file) {
  39103. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  39104. if (!$this->exists($origin)) {
  39105. $this->remove($file);
  39106. }
  39107. }
  39108. }
  39109. $copyOnWindows = false;
  39110. if (isset($options['copy_on_windows'])) {
  39111. $copyOnWindows = $options['copy_on_windows'];
  39112. }
  39113. if (null === $iterator) {
  39114. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  39115. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  39116. }
  39117. if ($this->exists($originDir)) {
  39118. $this->mkdir($targetDir);
  39119. }
  39120. foreach ($iterator as $file) {
  39121. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  39122. if ($copyOnWindows) {
  39123. if (is_file($file)) {
  39124. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  39125. } elseif (is_dir($file)) {
  39126. $this->mkdir($target);
  39127. } else {
  39128. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  39129. }
  39130. } else {
  39131. if (is_link($file)) {
  39132. $this->symlink($file->getLinkTarget(), $target);
  39133. } elseif (is_dir($file)) {
  39134. $this->mkdir($target);
  39135. } elseif (is_file($file)) {
  39136. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  39137. } else {
  39138. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  39139. }
  39140. }
  39141. }
  39142. }
  39143. public function isAbsolutePath($file)
  39144. {
  39145. return strspn($file, '/\\', 0, 1)
  39146. || (strlen($file) > 3 && ctype_alpha($file[0])
  39147. && ':' === substr($file, 1, 1)
  39148. && strspn($file, '/\\', 2, 1)
  39149. )
  39150. || null !== parse_url($file, PHP_URL_SCHEME)
  39151. ;
  39152. }
  39153. public function tempnam($dir, $prefix)
  39154. {
  39155. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  39156. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  39157. $tmpFile = @tempnam($hierarchy, $prefix);
  39158. if (false !== $tmpFile) {
  39159. if (null !== $scheme && 'gs' !== $scheme) {
  39160. return $scheme.'://'.$tmpFile;
  39161. }
  39162. return $tmpFile;
  39163. }
  39164. throw new IOException('A temporary file could not be created.');
  39165. }
  39166. for ($i = 0; $i < 10; ++$i) {
  39167. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  39168. $handle = @fopen($tmpFile, 'x+');
  39169. if (false === $handle) {
  39170. continue;
  39171. }
  39172. @fclose($handle);
  39173. return $tmpFile;
  39174. }
  39175. throw new IOException('A temporary file could not be created.');
  39176. }
  39177. public function dumpFile($filename, $content, $mode = 0666)
  39178. {
  39179. $dir = dirname($filename);
  39180. if (!is_dir($dir)) {
  39181. $this->mkdir($dir);
  39182. }
  39183. if (!is_writable($dir)) {
  39184. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  39185. }
  39186. $tmpFile = $this->tempnam($dir, basename($filename));
  39187. if (false === @file_put_contents($tmpFile, $content)) {
  39188. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  39189. }
  39190. if (null !== $mode) {
  39191. if (func_num_args() > 2) {
  39192. @trigger_error('Support for modifying file permissions is deprecated since version 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  39193. }
  39194. $this->chmod($tmpFile, $mode);
  39195. } elseif (file_exists($filename)) {
  39196. @chmod($tmpFile, fileperms($filename));
  39197. }
  39198. $this->rename($tmpFile, $filename, true);
  39199. }
  39200. private function toIterator($files)
  39201. {
  39202. if (!$files instanceof \Traversable) {
  39203. $files = new \ArrayObject(is_array($files) ? $files : array($files));
  39204. }
  39205. return $files;
  39206. }
  39207. private function getSchemeAndHierarchy($filename)
  39208. {
  39209. $components = explode('://', $filename, 2);
  39210. return 2 === count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  39211. }
  39212. }
  39213. Copyright (c) 2004-2017 Fabien Potencier
  39214. Permission is hereby granted, free of charge, to any person obtaining a copy
  39215. of this software and associated documentation files (the "Software"), to deal
  39216. in the Software without restriction, including without limitation the rights
  39217. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39218. copies of the Software, and to permit persons to whom the Software is furnished
  39219. to do so, subject to the following conditions:
  39220. The above copyright notice and this permission notice shall be included in all
  39221. copies or substantial portions of the Software.
  39222. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39223. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39224. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39225. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39226. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39227. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39228. THE SOFTWARE.
  39229. <?php
  39230. namespace Symfony\Component\Filesystem;
  39231. use Symfony\Component\Filesystem\Exception\IOException;
  39232. class LockHandler
  39233. {
  39234. private $file;
  39235. private $handle;
  39236. public function __construct($name, $lockPath = null)
  39237. {
  39238. $lockPath = $lockPath ?: sys_get_temp_dir();
  39239. if (!is_dir($lockPath)) {
  39240. $fs = new Filesystem();
  39241. $fs->mkdir($lockPath);
  39242. }
  39243. if (!is_writable($lockPath)) {
  39244. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  39245. }
  39246. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  39247. }
  39248. public function lock($blocking = false)
  39249. {
  39250. if ($this->handle) {
  39251. return true;
  39252. }
  39253. $error = null;
  39254. set_error_handler(function ($errno, $msg) use (&$error) {
  39255. $error = $msg;
  39256. });
  39257. if (!$this->handle = fopen($this->file, 'r')) {
  39258. if ($this->handle = fopen($this->file, 'x')) {
  39259. chmod($this->file, 0444);
  39260. } elseif (!$this->handle = fopen($this->file, 'r')) {
  39261. usleep(100);
  39262. $this->handle = fopen($this->file, 'r');
  39263. }
  39264. }
  39265. restore_error_handler();
  39266. if (!$this->handle) {
  39267. throw new IOException($error, 0, null, $this->file);
  39268. }
  39269. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  39270. fclose($this->handle);
  39271. $this->handle = null;
  39272. return false;
  39273. }
  39274. return true;
  39275. }
  39276. public function release()
  39277. {
  39278. if ($this->handle) {
  39279. flock($this->handle, LOCK_UN | LOCK_NB);
  39280. fclose($this->handle);
  39281. $this->handle = null;
  39282. }
  39283. }
  39284. }
  39285. <?php
  39286. namespace Symfony\Component\Finder\Adapter;
  39287. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39288. abstract class AbstractAdapter implements AdapterInterface
  39289. {
  39290. protected $followLinks = false;
  39291. protected $mode = 0;
  39292. protected $minDepth = 0;
  39293. protected $maxDepth = PHP_INT_MAX;
  39294. protected $exclude = array();
  39295. protected $names = array();
  39296. protected $notNames = array();
  39297. protected $contains = array();
  39298. protected $notContains = array();
  39299. protected $sizes = array();
  39300. protected $dates = array();
  39301. protected $filters = array();
  39302. protected $sort = false;
  39303. protected $paths = array();
  39304. protected $notPaths = array();
  39305. protected $ignoreUnreadableDirs = false;
  39306. private static $areSupported = array();
  39307. public function isSupported()
  39308. {
  39309. $name = $this->getName();
  39310. if (!array_key_exists($name, self::$areSupported)) {
  39311. self::$areSupported[$name] = $this->canBeUsed();
  39312. }
  39313. return self::$areSupported[$name];
  39314. }
  39315. public function setFollowLinks($followLinks)
  39316. {
  39317. $this->followLinks = $followLinks;
  39318. return $this;
  39319. }
  39320. public function setMode($mode)
  39321. {
  39322. $this->mode = $mode;
  39323. return $this;
  39324. }
  39325. public function setDepths(array $depths)
  39326. {
  39327. $this->minDepth = 0;
  39328. $this->maxDepth = PHP_INT_MAX;
  39329. foreach ($depths as $comparator) {
  39330. switch ($comparator->getOperator()) {
  39331. case '>':
  39332. $this->minDepth = $comparator->getTarget() + 1;
  39333. break;
  39334. case '>=':
  39335. $this->minDepth = $comparator->getTarget();
  39336. break;
  39337. case '<':
  39338. $this->maxDepth = $comparator->getTarget() - 1;
  39339. break;
  39340. case '<=':
  39341. $this->maxDepth = $comparator->getTarget();
  39342. break;
  39343. default:
  39344. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  39345. }
  39346. }
  39347. return $this;
  39348. }
  39349. public function setExclude(array $exclude)
  39350. {
  39351. $this->exclude = $exclude;
  39352. return $this;
  39353. }
  39354. public function setNames(array $names)
  39355. {
  39356. $this->names = $names;
  39357. return $this;
  39358. }
  39359. public function setNotNames(array $notNames)
  39360. {
  39361. $this->notNames = $notNames;
  39362. return $this;
  39363. }
  39364. public function setContains(array $contains)
  39365. {
  39366. $this->contains = $contains;
  39367. return $this;
  39368. }
  39369. public function setNotContains(array $notContains)
  39370. {
  39371. $this->notContains = $notContains;
  39372. return $this;
  39373. }
  39374. public function setSizes(array $sizes)
  39375. {
  39376. $this->sizes = $sizes;
  39377. return $this;
  39378. }
  39379. public function setDates(array $dates)
  39380. {
  39381. $this->dates = $dates;
  39382. return $this;
  39383. }
  39384. public function setFilters(array $filters)
  39385. {
  39386. $this->filters = $filters;
  39387. return $this;
  39388. }
  39389. public function setSort($sort)
  39390. {
  39391. $this->sort = $sort;
  39392. return $this;
  39393. }
  39394. public function setPath(array $paths)
  39395. {
  39396. $this->paths = $paths;
  39397. return $this;
  39398. }
  39399. public function setNotPath(array $notPaths)
  39400. {
  39401. $this->notPaths = $notPaths;
  39402. return $this;
  39403. }
  39404. public function ignoreUnreadableDirs($ignore = true)
  39405. {
  39406. $this->ignoreUnreadableDirs = (bool) $ignore;
  39407. return $this;
  39408. }
  39409. abstract protected function canBeUsed();
  39410. }
  39411. <?php
  39412. namespace Symfony\Component\Finder\Adapter;
  39413. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39414. use Symfony\Component\Finder\Exception\AccessDeniedException;
  39415. use Symfony\Component\Finder\Iterator;
  39416. use Symfony\Component\Finder\Shell\Shell;
  39417. use Symfony\Component\Finder\Expression\Expression;
  39418. use Symfony\Component\Finder\Shell\Command;
  39419. use Symfony\Component\Finder\Comparator\NumberComparator;
  39420. use Symfony\Component\Finder\Comparator\DateComparator;
  39421. abstract class AbstractFindAdapter extends AbstractAdapter
  39422. {
  39423. protected $shell;
  39424. public function __construct()
  39425. {
  39426. $this->shell = new Shell();
  39427. }
  39428. public function searchInDirectory($dir)
  39429. {
  39430. $dir = realpath($dir);
  39431. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  39432. return new Iterator\FilePathsIterator(array(), $dir);
  39433. }
  39434. $command = Command::create();
  39435. $find = $this->buildFindCommand($command, $dir);
  39436. if ($this->followLinks) {
  39437. $find->add('-follow');
  39438. }
  39439. $find->add('-mindepth')->add($this->minDepth + 1);
  39440. if (PHP_INT_MAX !== $this->maxDepth) {
  39441. $find->add('-maxdepth')->add($this->maxDepth + 1);
  39442. }
  39443. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  39444. $find->add('-type d');
  39445. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  39446. $find->add('-type f');
  39447. }
  39448. $this->buildNamesFiltering($find, $this->names);
  39449. $this->buildNamesFiltering($find, $this->notNames, true);
  39450. $this->buildPathsFiltering($find, $dir, $this->paths);
  39451. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  39452. $this->buildSizesFiltering($find, $this->sizes);
  39453. $this->buildDatesFiltering($find, $this->dates);
  39454. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  39455. $useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  39456. if ($useGrep && ($this->contains || $this->notContains)) {
  39457. $grep = $command->ins('grep');
  39458. $this->buildContentFiltering($grep, $this->contains);
  39459. $this->buildContentFiltering($grep, $this->notContains, true);
  39460. }
  39461. if ($useSort) {
  39462. $this->buildSorting($command, $this->sort);
  39463. }
  39464. $command->setErrorHandler(
  39465. $this->ignoreUnreadableDirs
  39466. ? function ($stderr) { }
  39467. : function ($stderr) { throw new AccessDeniedException($stderr); }
  39468. );
  39469. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  39470. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  39471. if ($this->exclude) {
  39472. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  39473. }
  39474. if (!$useGrep && ($this->contains || $this->notContains)) {
  39475. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  39476. }
  39477. if ($this->filters) {
  39478. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  39479. }
  39480. if (!$useSort && $this->sort) {
  39481. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  39482. $iterator = $iteratorAggregate->getIterator();
  39483. }
  39484. return $iterator;
  39485. }
  39486. protected function canBeUsed()
  39487. {
  39488. return $this->shell->testCommand('find');
  39489. }
  39490. protected function buildFindCommand(Command $command, $dir)
  39491. {
  39492. return $command
  39493. ->ins('find')
  39494. ->add('find ')
  39495. ->arg($dir)
  39496. ->add('-noleaf');
  39497. }
  39498. private function buildNamesFiltering(Command $command, array $names, $not = false)
  39499. {
  39500. if (0 === count($names)) {
  39501. return;
  39502. }
  39503. $command->add($not ? '-not' : null)->cmd('(');
  39504. foreach ($names as $i => $name) {
  39505. $expr = Expression::create($name);
  39506. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  39507. $expr = Expression::create($expr->getGlob()->toRegex(false));
  39508. }
  39509. if ($expr->isRegex()) {
  39510. $regex = $expr->getRegex();
  39511. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  39512. ->setStartFlag(false)
  39513. ->setStartJoker(true)
  39514. ->replaceJokers('[^/]');
  39515. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  39516. $regex->setEndJoker(false)->append('[^/]*');
  39517. }
  39518. }
  39519. $command
  39520. ->add($i > 0 ? '-or' : null)
  39521. ->add($expr->isRegex()
  39522. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  39523. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  39524. )
  39525. ->arg($expr->renderPattern());
  39526. }
  39527. $command->cmd(')');
  39528. }
  39529. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  39530. {
  39531. if (0 === count($paths)) {
  39532. return;
  39533. }
  39534. $command->add($not ? '-not' : null)->cmd('(');
  39535. foreach ($paths as $i => $path) {
  39536. $expr = Expression::create($path);
  39537. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  39538. $expr = Expression::create($expr->getGlob()->toRegex(false));
  39539. }
  39540. if ($expr->isRegex()) {
  39541. $regex = $expr->getRegex();
  39542. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  39543. } else {
  39544. $expr->prepend('*')->append('*');
  39545. }
  39546. $command
  39547. ->add($i > 0 ? '-or' : null)
  39548. ->add($expr->isRegex()
  39549. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  39550. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  39551. )
  39552. ->arg($expr->renderPattern());
  39553. }
  39554. $command->cmd(')');
  39555. }
  39556. private function buildSizesFiltering(Command $command, array $sizes)
  39557. {
  39558. foreach ($sizes as $i => $size) {
  39559. $command->add($i > 0 ? '-and' : null);
  39560. switch ($size->getOperator()) {
  39561. case '<=':
  39562. $command->add('-size -'.($size->getTarget() + 1).'c');
  39563. break;
  39564. case '>=':
  39565. $command->add('-size +'.($size->getTarget() - 1).'c');
  39566. break;
  39567. case '>':
  39568. $command->add('-size +'.$size->getTarget().'c');
  39569. break;
  39570. case '!=':
  39571. $command->add('-size -'.$size->getTarget().'c');
  39572. $command->add('-size +'.$size->getTarget().'c');
  39573. break;
  39574. case '<':
  39575. default:
  39576. $command->add('-size -'.$size->getTarget().'c');
  39577. }
  39578. }
  39579. }
  39580. private function buildDatesFiltering(Command $command, array $dates)
  39581. {
  39582. foreach ($dates as $i => $date) {
  39583. $command->add($i > 0 ? '-and' : null);
  39584. $mins = (int) round((time() - $date->getTarget()) / 60);
  39585. if (0 > $mins) {
  39586. $command->add(' -mmin -0');
  39587. return;
  39588. }
  39589. switch ($date->getOperator()) {
  39590. case '<=':
  39591. $command->add('-mmin +'.($mins - 1));
  39592. break;
  39593. case '>=':
  39594. $command->add('-mmin -'.($mins + 1));
  39595. break;
  39596. case '>':
  39597. $command->add('-mmin -'.$mins);
  39598. break;
  39599. case '!=':
  39600. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  39601. break;
  39602. case '<':
  39603. default:
  39604. $command->add('-mmin +'.$mins);
  39605. }
  39606. }
  39607. }
  39608. private function buildSorting(Command $command, $sort)
  39609. {
  39610. $this->buildFormatSorting($command, $sort);
  39611. }
  39612. abstract protected function buildFormatSorting(Command $command, $sort);
  39613. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  39614. }
  39615. <?php
  39616. namespace Symfony\Component\Finder\Adapter;
  39617. interface AdapterInterface
  39618. {
  39619. public function setFollowLinks($followLinks);
  39620. public function setMode($mode);
  39621. public function setExclude(array $exclude);
  39622. public function setDepths(array $depths);
  39623. public function setNames(array $names);
  39624. public function setNotNames(array $notNames);
  39625. public function setContains(array $contains);
  39626. public function setNotContains(array $notContains);
  39627. public function setSizes(array $sizes);
  39628. public function setDates(array $dates);
  39629. public function setFilters(array $filters);
  39630. public function setSort($sort);
  39631. public function setPath(array $paths);
  39632. public function setNotPath(array $notPaths);
  39633. public function ignoreUnreadableDirs($ignore = true);
  39634. public function searchInDirectory($dir);
  39635. public function isSupported();
  39636. public function getName();
  39637. }
  39638. <?php
  39639. namespace Symfony\Component\Finder\Adapter;
  39640. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39641. use Symfony\Component\Finder\Shell\Shell;
  39642. use Symfony\Component\Finder\Shell\Command;
  39643. use Symfony\Component\Finder\Iterator\SortableIterator;
  39644. use Symfony\Component\Finder\Expression\Expression;
  39645. class BsdFindAdapter extends AbstractFindAdapter
  39646. {
  39647. public function getName()
  39648. {
  39649. return 'bsd_find';
  39650. }
  39651. protected function canBeUsed()
  39652. {
  39653. return in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  39654. }
  39655. protected function buildFormatSorting(Command $command, $sort)
  39656. {
  39657. switch ($sort) {
  39658. case SortableIterator::SORT_BY_NAME:
  39659. $command->ins('sort')->add('| sort');
  39660. return;
  39661. case SortableIterator::SORT_BY_TYPE:
  39662. $format = '%HT';
  39663. break;
  39664. case SortableIterator::SORT_BY_ACCESSED_TIME:
  39665. $format = '%a';
  39666. break;
  39667. case SortableIterator::SORT_BY_CHANGED_TIME:
  39668. $format = '%c';
  39669. break;
  39670. case SortableIterator::SORT_BY_MODIFIED_TIME:
  39671. $format = '%m';
  39672. break;
  39673. default:
  39674. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  39675. }
  39676. $command
  39677. ->add('-print0 | xargs -0 stat -f')
  39678. ->arg($format.'%t%N')
  39679. ->add('| sort | cut -f 2');
  39680. }
  39681. protected function buildFindCommand(Command $command, $dir)
  39682. {
  39683. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  39684. return $command;
  39685. }
  39686. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  39687. {
  39688. foreach ($contains as $contain) {
  39689. $expr = Expression::create($contain);
  39690. $command
  39691. ->add('| grep -v \'^$\'')
  39692. ->add('| xargs -I{} grep -I')
  39693. ->add($expr->isCaseSensitive() ? null : '-i')
  39694. ->add($not ? '-L' : '-l')
  39695. ->add('-Ee')->arg($expr->renderPattern())
  39696. ->add('{}')
  39697. ;
  39698. }
  39699. }
  39700. }
  39701. <?php
  39702. namespace Symfony\Component\Finder\Adapter;
  39703. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39704. use Symfony\Component\Finder\Shell\Shell;
  39705. use Symfony\Component\Finder\Shell\Command;
  39706. use Symfony\Component\Finder\Iterator\SortableIterator;
  39707. use Symfony\Component\Finder\Expression\Expression;
  39708. class GnuFindAdapter extends AbstractFindAdapter
  39709. {
  39710. public function getName()
  39711. {
  39712. return 'gnu_find';
  39713. }
  39714. protected function buildFormatSorting(Command $command, $sort)
  39715. {
  39716. switch ($sort) {
  39717. case SortableIterator::SORT_BY_NAME:
  39718. $command->ins('sort')->add('| sort');
  39719. return;
  39720. case SortableIterator::SORT_BY_TYPE:
  39721. $format = '%y';
  39722. break;
  39723. case SortableIterator::SORT_BY_ACCESSED_TIME:
  39724. $format = '%A@';
  39725. break;
  39726. case SortableIterator::SORT_BY_CHANGED_TIME:
  39727. $format = '%C@';
  39728. break;
  39729. case SortableIterator::SORT_BY_MODIFIED_TIME:
  39730. $format = '%T@';
  39731. break;
  39732. default:
  39733. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  39734. }
  39735. $command
  39736. ->get('find')
  39737. ->add('-printf')
  39738. ->arg($format.' %h/%f\\n')
  39739. ->add('| sort | cut')
  39740. ->arg('-d ')
  39741. ->arg('-f2-')
  39742. ;
  39743. }
  39744. protected function canBeUsed()
  39745. {
  39746. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  39747. }
  39748. protected function buildFindCommand(Command $command, $dir)
  39749. {
  39750. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  39751. }
  39752. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  39753. {
  39754. foreach ($contains as $contain) {
  39755. $expr = Expression::create($contain);
  39756. $command
  39757. ->add('| xargs -I{} -r grep -I')
  39758. ->add($expr->isCaseSensitive() ? null : '-i')
  39759. ->add($not ? '-L' : '-l')
  39760. ->add('-Ee')->arg($expr->renderPattern())
  39761. ->add('{}')
  39762. ;
  39763. }
  39764. }
  39765. }
  39766. <?php
  39767. namespace Symfony\Component\Finder\Adapter;
  39768. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39769. use Symfony\Component\Finder\Iterator;
  39770. class PhpAdapter extends AbstractAdapter
  39771. {
  39772. public function searchInDirectory($dir)
  39773. {
  39774. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  39775. if ($this->followLinks) {
  39776. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  39777. }
  39778. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  39779. if ($this->exclude) {
  39780. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  39781. }
  39782. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  39783. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  39784. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  39785. }
  39786. if ($this->mode) {
  39787. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  39788. }
  39789. if ($this->names || $this->notNames) {
  39790. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  39791. }
  39792. if ($this->contains || $this->notContains) {
  39793. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  39794. }
  39795. if ($this->sizes) {
  39796. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  39797. }
  39798. if ($this->dates) {
  39799. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  39800. }
  39801. if ($this->filters) {
  39802. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  39803. }
  39804. if ($this->paths || $this->notPaths) {
  39805. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  39806. }
  39807. if ($this->sort) {
  39808. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  39809. $iterator = $iteratorAggregate->getIterator();
  39810. }
  39811. return $iterator;
  39812. }
  39813. public function getName()
  39814. {
  39815. return 'php';
  39816. }
  39817. protected function canBeUsed()
  39818. {
  39819. return true;
  39820. }
  39821. }
  39822. <?php
  39823. namespace Symfony\Component\Finder\Comparator;
  39824. class Comparator
  39825. {
  39826. private $target;
  39827. private $operator = '==';
  39828. public function getTarget()
  39829. {
  39830. return $this->target;
  39831. }
  39832. public function setTarget($target)
  39833. {
  39834. $this->target = $target;
  39835. }
  39836. public function getOperator()
  39837. {
  39838. return $this->operator;
  39839. }
  39840. public function setOperator($operator)
  39841. {
  39842. if (!$operator) {
  39843. $operator = '==';
  39844. }
  39845. if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  39846. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  39847. }
  39848. $this->operator = $operator;
  39849. }
  39850. public function test($test)
  39851. {
  39852. switch ($this->operator) {
  39853. case '>':
  39854. return $test > $this->target;
  39855. case '>=':
  39856. return $test >= $this->target;
  39857. case '<':
  39858. return $test < $this->target;
  39859. case '<=':
  39860. return $test <= $this->target;
  39861. case '!=':
  39862. return $test != $this->target;
  39863. }
  39864. return $test == $this->target;
  39865. }
  39866. }
  39867. <?php
  39868. namespace Symfony\Component\Finder\Comparator;
  39869. class DateComparator extends Comparator
  39870. {
  39871. public function __construct($test)
  39872. {
  39873. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  39874. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  39875. }
  39876. try {
  39877. $date = new \DateTime($matches[2]);
  39878. $target = $date->format('U');
  39879. } catch (\Exception $e) {
  39880. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  39881. }
  39882. $operator = isset($matches[1]) ? $matches[1] : '==';
  39883. if ('since' === $operator || 'after' === $operator) {
  39884. $operator = '>';
  39885. }
  39886. if ('until' === $operator || 'before' === $operator) {
  39887. $operator = '<';
  39888. }
  39889. $this->setOperator($operator);
  39890. $this->setTarget($target);
  39891. }
  39892. }
  39893. <?php
  39894. namespace Symfony\Component\Finder\Comparator;
  39895. class NumberComparator extends Comparator
  39896. {
  39897. public function __construct($test)
  39898. {
  39899. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  39900. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  39901. }
  39902. $target = $matches[2];
  39903. if (!is_numeric($target)) {
  39904. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  39905. }
  39906. if (isset($matches[3])) {
  39907. switch (strtolower($matches[3])) {
  39908. case 'k':
  39909. $target *= 1000;
  39910. break;
  39911. case 'ki':
  39912. $target *= 1024;
  39913. break;
  39914. case 'm':
  39915. $target *= 1000000;
  39916. break;
  39917. case 'mi':
  39918. $target *= 1024 * 1024;
  39919. break;
  39920. case 'g':
  39921. $target *= 1000000000;
  39922. break;
  39923. case 'gi':
  39924. $target *= 1024 * 1024 * 1024;
  39925. break;
  39926. }
  39927. }
  39928. $this->setTarget($target);
  39929. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  39930. }
  39931. }
  39932. <?php
  39933. namespace Symfony\Component\Finder\Exception;
  39934. class AccessDeniedException extends \UnexpectedValueException
  39935. {
  39936. }
  39937. <?php
  39938. namespace Symfony\Component\Finder\Exception;
  39939. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39940. use Symfony\Component\Finder\Adapter\AdapterInterface;
  39941. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  39942. {
  39943. private $adapter;
  39944. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  39945. {
  39946. $this->adapter = $adapter;
  39947. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  39948. }
  39949. public function getAdapter()
  39950. {
  39951. return $this->adapter;
  39952. }
  39953. }
  39954. <?php
  39955. namespace Symfony\Component\Finder\Exception;
  39956. interface ExceptionInterface
  39957. {
  39958. public function getAdapter();
  39959. }
  39960. <?php
  39961. namespace Symfony\Component\Finder\Exception;
  39962. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39963. class OperationNotPermitedException extends AdapterFailureException
  39964. {
  39965. }
  39966. <?php
  39967. namespace Symfony\Component\Finder\Exception;
  39968. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39969. use Symfony\Component\Finder\Adapter\AdapterInterface;
  39970. use Symfony\Component\Finder\Shell\Command;
  39971. class ShellCommandFailureException extends AdapterFailureException
  39972. {
  39973. private $command;
  39974. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  39975. {
  39976. $this->command = $command;
  39977. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  39978. }
  39979. public function getCommand()
  39980. {
  39981. return $this->command;
  39982. }
  39983. }
  39984. <?php
  39985. namespace Symfony\Component\Finder\Expression;
  39986. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39987. class Expression implements ValueInterface
  39988. {
  39989. const TYPE_REGEX = 1;
  39990. const TYPE_GLOB = 2;
  39991. private $value;
  39992. public static function create($expr)
  39993. {
  39994. return new self($expr);
  39995. }
  39996. public function __construct($expr)
  39997. {
  39998. try {
  39999. $this->value = Regex::create($expr);
  40000. } catch (\InvalidArgumentException $e) {
  40001. $this->value = new Glob($expr);
  40002. }
  40003. }
  40004. public function __toString()
  40005. {
  40006. return $this->render();
  40007. }
  40008. public function render()
  40009. {
  40010. return $this->value->render();
  40011. }
  40012. public function renderPattern()
  40013. {
  40014. return $this->value->renderPattern();
  40015. }
  40016. public function isCaseSensitive()
  40017. {
  40018. return $this->value->isCaseSensitive();
  40019. }
  40020. public function getType()
  40021. {
  40022. return $this->value->getType();
  40023. }
  40024. public function prepend($expr)
  40025. {
  40026. $this->value->prepend($expr);
  40027. return $this;
  40028. }
  40029. public function append($expr)
  40030. {
  40031. $this->value->append($expr);
  40032. return $this;
  40033. }
  40034. public function isRegex()
  40035. {
  40036. return self::TYPE_REGEX === $this->value->getType();
  40037. }
  40038. public function isGlob()
  40039. {
  40040. return self::TYPE_GLOB === $this->value->getType();
  40041. }
  40042. public function getGlob()
  40043. {
  40044. if (self::TYPE_GLOB !== $this->value->getType()) {
  40045. throw new \LogicException('Regex can\'t be transformed to glob.');
  40046. }
  40047. return $this->value;
  40048. }
  40049. public function getRegex()
  40050. {
  40051. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  40052. }
  40053. }
  40054. <?php
  40055. namespace Symfony\Component\Finder\Expression;
  40056. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40057. use Symfony\Component\Finder\Glob as FinderGlob;
  40058. class Glob implements ValueInterface
  40059. {
  40060. private $pattern;
  40061. public function __construct($pattern)
  40062. {
  40063. $this->pattern = $pattern;
  40064. }
  40065. public function render()
  40066. {
  40067. return $this->pattern;
  40068. }
  40069. public function renderPattern()
  40070. {
  40071. return $this->pattern;
  40072. }
  40073. public function getType()
  40074. {
  40075. return Expression::TYPE_GLOB;
  40076. }
  40077. public function isCaseSensitive()
  40078. {
  40079. return true;
  40080. }
  40081. public function prepend($expr)
  40082. {
  40083. $this->pattern = $expr.$this->pattern;
  40084. return $this;
  40085. }
  40086. public function append($expr)
  40087. {
  40088. $this->pattern .= $expr;
  40089. return $this;
  40090. }
  40091. public function isExpandable()
  40092. {
  40093. return false !== strpos($this->pattern, '{')
  40094. && false !== strpos($this->pattern, '}');
  40095. }
  40096. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  40097. {
  40098. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  40099. return new Regex($regex);
  40100. }
  40101. }
  40102. <?php
  40103. namespace Symfony\Component\Finder\Expression;
  40104. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40105. class Regex implements ValueInterface
  40106. {
  40107. const START_FLAG = '^';
  40108. const END_FLAG = '$';
  40109. const BOUNDARY = '~';
  40110. const JOKER = '.*';
  40111. const ESCAPING = '\\';
  40112. private $pattern;
  40113. private $options;
  40114. private $startFlag;
  40115. private $endFlag;
  40116. private $startJoker;
  40117. private $endJoker;
  40118. public static function create($expr)
  40119. {
  40120. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  40121. $start = substr($m[1], 0, 1);
  40122. $end = substr($m[1], -1);
  40123. if (
  40124. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  40125. || ('{' === $start && '}' === $end)
  40126. || ('(' === $start && ')' === $end)
  40127. ) {
  40128. return new self(substr($m[1], 1, -1), $m[2], $end);
  40129. }
  40130. }
  40131. throw new \InvalidArgumentException('Given expression is not a regex.');
  40132. }
  40133. public function __construct($pattern, $options = '', $delimiter = null)
  40134. {
  40135. if (null !== $delimiter) {
  40136. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  40137. }
  40138. $this->parsePattern($pattern);
  40139. $this->options = $options;
  40140. }
  40141. public function __toString()
  40142. {
  40143. return $this->render();
  40144. }
  40145. public function render()
  40146. {
  40147. return self::BOUNDARY
  40148. .$this->renderPattern()
  40149. .self::BOUNDARY
  40150. .$this->options;
  40151. }
  40152. public function renderPattern()
  40153. {
  40154. return ($this->startFlag ? self::START_FLAG : '')
  40155. .($this->startJoker ? self::JOKER : '')
  40156. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  40157. .($this->endJoker ? self::JOKER : '')
  40158. .($this->endFlag ? self::END_FLAG : '');
  40159. }
  40160. public function isCaseSensitive()
  40161. {
  40162. return !$this->hasOption('i');
  40163. }
  40164. public function getType()
  40165. {
  40166. return Expression::TYPE_REGEX;
  40167. }
  40168. public function prepend($expr)
  40169. {
  40170. $this->pattern = $expr.$this->pattern;
  40171. return $this;
  40172. }
  40173. public function append($expr)
  40174. {
  40175. $this->pattern .= $expr;
  40176. return $this;
  40177. }
  40178. public function hasOption($option)
  40179. {
  40180. return false !== strpos($this->options, $option);
  40181. }
  40182. public function addOption($option)
  40183. {
  40184. if (!$this->hasOption($option)) {
  40185. $this->options .= $option;
  40186. }
  40187. return $this;
  40188. }
  40189. public function removeOption($option)
  40190. {
  40191. $this->options = str_replace($option, '', $this->options);
  40192. return $this;
  40193. }
  40194. public function setStartFlag($startFlag)
  40195. {
  40196. $this->startFlag = $startFlag;
  40197. return $this;
  40198. }
  40199. public function hasStartFlag()
  40200. {
  40201. return $this->startFlag;
  40202. }
  40203. public function setEndFlag($endFlag)
  40204. {
  40205. $this->endFlag = (bool) $endFlag;
  40206. return $this;
  40207. }
  40208. public function hasEndFlag()
  40209. {
  40210. return $this->endFlag;
  40211. }
  40212. public function setStartJoker($startJoker)
  40213. {
  40214. $this->startJoker = $startJoker;
  40215. return $this;
  40216. }
  40217. public function hasStartJoker()
  40218. {
  40219. return $this->startJoker;
  40220. }
  40221. public function setEndJoker($endJoker)
  40222. {
  40223. $this->endJoker = (bool) $endJoker;
  40224. return $this;
  40225. }
  40226. public function hasEndJoker()
  40227. {
  40228. return $this->endJoker;
  40229. }
  40230. public function replaceJokers($replacement)
  40231. {
  40232. $replace = function ($subject) use ($replacement) {
  40233. $subject = $subject[0];
  40234. $replace = 0 === substr_count($subject, '\\') % 2;
  40235. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  40236. };
  40237. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  40238. return $this;
  40239. }
  40240. private function parsePattern($pattern)
  40241. {
  40242. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  40243. $pattern = substr($pattern, 1);
  40244. }
  40245. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  40246. $pattern = substr($pattern, 2);
  40247. }
  40248. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  40249. $pattern = substr($pattern, 0, -1);
  40250. }
  40251. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  40252. $pattern = substr($pattern, 0, -2);
  40253. }
  40254. $this->pattern = $pattern;
  40255. }
  40256. }
  40257. <?php
  40258. namespace Symfony\Component\Finder\Expression;
  40259. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40260. interface ValueInterface
  40261. {
  40262. public function render();
  40263. public function renderPattern();
  40264. public function isCaseSensitive();
  40265. public function getType();
  40266. public function prepend($expr);
  40267. public function append($expr);
  40268. }
  40269. <?php
  40270. namespace Symfony\Component\Finder;
  40271. use Symfony\Component\Finder\Adapter\AdapterInterface;
  40272. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  40273. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  40274. use Symfony\Component\Finder\Adapter\PhpAdapter;
  40275. use Symfony\Component\Finder\Comparator\DateComparator;
  40276. use Symfony\Component\Finder\Comparator\NumberComparator;
  40277. use Symfony\Component\Finder\Exception\ExceptionInterface;
  40278. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  40279. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  40280. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  40281. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  40282. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  40283. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  40284. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  40285. use Symfony\Component\Finder\Iterator\SortableIterator;
  40286. class Finder implements \IteratorAggregate, \Countable
  40287. {
  40288. const IGNORE_VCS_FILES = 1;
  40289. const IGNORE_DOT_FILES = 2;
  40290. private $mode = 0;
  40291. private $names = array();
  40292. private $notNames = array();
  40293. private $exclude = array();
  40294. private $filters = array();
  40295. private $depths = array();
  40296. private $sizes = array();
  40297. private $followLinks = false;
  40298. private $sort = false;
  40299. private $ignore = 0;
  40300. private $dirs = array();
  40301. private $dates = array();
  40302. private $iterators = array();
  40303. private $contains = array();
  40304. private $notContains = array();
  40305. private $adapters = null;
  40306. private $paths = array();
  40307. private $notPaths = array();
  40308. private $ignoreUnreadableDirs = false;
  40309. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  40310. public function __construct()
  40311. {
  40312. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  40313. }
  40314. public static function create()
  40315. {
  40316. return new static();
  40317. }
  40318. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  40319. {
  40320. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40321. $this->initDefaultAdapters();
  40322. $this->adapters[$adapter->getName()] = array(
  40323. 'adapter' => $adapter,
  40324. 'priority' => $priority,
  40325. 'selected' => false,
  40326. );
  40327. return $this->sortAdapters();
  40328. }
  40329. public function useBestAdapter()
  40330. {
  40331. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40332. $this->initDefaultAdapters();
  40333. $this->resetAdapterSelection();
  40334. return $this->sortAdapters();
  40335. }
  40336. public function setAdapter($name)
  40337. {
  40338. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40339. $this->initDefaultAdapters();
  40340. if (!isset($this->adapters[$name])) {
  40341. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  40342. }
  40343. $this->resetAdapterSelection();
  40344. $this->adapters[$name]['selected'] = true;
  40345. return $this->sortAdapters();
  40346. }
  40347. public function removeAdapters()
  40348. {
  40349. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40350. $this->adapters = array();
  40351. return $this;
  40352. }
  40353. public function getAdapters()
  40354. {
  40355. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40356. $this->initDefaultAdapters();
  40357. return array_values(array_map(function (array $adapter) {
  40358. return $adapter['adapter'];
  40359. }, $this->adapters));
  40360. }
  40361. public function directories()
  40362. {
  40363. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  40364. return $this;
  40365. }
  40366. public function files()
  40367. {
  40368. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  40369. return $this;
  40370. }
  40371. public function depth($level)
  40372. {
  40373. $this->depths[] = new Comparator\NumberComparator($level);
  40374. return $this;
  40375. }
  40376. public function date($date)
  40377. {
  40378. $this->dates[] = new Comparator\DateComparator($date);
  40379. return $this;
  40380. }
  40381. public function name($pattern)
  40382. {
  40383. $this->names[] = $pattern;
  40384. return $this;
  40385. }
  40386. public function notName($pattern)
  40387. {
  40388. $this->notNames[] = $pattern;
  40389. return $this;
  40390. }
  40391. public function contains($pattern)
  40392. {
  40393. $this->contains[] = $pattern;
  40394. return $this;
  40395. }
  40396. public function notContains($pattern)
  40397. {
  40398. $this->notContains[] = $pattern;
  40399. return $this;
  40400. }
  40401. public function path($pattern)
  40402. {
  40403. $this->paths[] = $pattern;
  40404. return $this;
  40405. }
  40406. public function notPath($pattern)
  40407. {
  40408. $this->notPaths[] = $pattern;
  40409. return $this;
  40410. }
  40411. public function size($size)
  40412. {
  40413. $this->sizes[] = new Comparator\NumberComparator($size);
  40414. return $this;
  40415. }
  40416. public function exclude($dirs)
  40417. {
  40418. $this->exclude = array_merge($this->exclude, (array) $dirs);
  40419. return $this;
  40420. }
  40421. public function ignoreDotFiles($ignoreDotFiles)
  40422. {
  40423. if ($ignoreDotFiles) {
  40424. $this->ignore |= static::IGNORE_DOT_FILES;
  40425. } else {
  40426. $this->ignore &= ~static::IGNORE_DOT_FILES;
  40427. }
  40428. return $this;
  40429. }
  40430. public function ignoreVCS($ignoreVCS)
  40431. {
  40432. if ($ignoreVCS) {
  40433. $this->ignore |= static::IGNORE_VCS_FILES;
  40434. } else {
  40435. $this->ignore &= ~static::IGNORE_VCS_FILES;
  40436. }
  40437. return $this;
  40438. }
  40439. public static function addVCSPattern($pattern)
  40440. {
  40441. foreach ((array) $pattern as $p) {
  40442. self::$vcsPatterns[] = $p;
  40443. }
  40444. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  40445. }
  40446. public function sort(\Closure $closure)
  40447. {
  40448. $this->sort = $closure;
  40449. return $this;
  40450. }
  40451. public function sortByName()
  40452. {
  40453. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  40454. return $this;
  40455. }
  40456. public function sortByType()
  40457. {
  40458. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  40459. return $this;
  40460. }
  40461. public function sortByAccessedTime()
  40462. {
  40463. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  40464. return $this;
  40465. }
  40466. public function sortByChangedTime()
  40467. {
  40468. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  40469. return $this;
  40470. }
  40471. public function sortByModifiedTime()
  40472. {
  40473. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  40474. return $this;
  40475. }
  40476. public function filter(\Closure $closure)
  40477. {
  40478. $this->filters[] = $closure;
  40479. return $this;
  40480. }
  40481. public function followLinks()
  40482. {
  40483. $this->followLinks = true;
  40484. return $this;
  40485. }
  40486. public function ignoreUnreadableDirs($ignore = true)
  40487. {
  40488. $this->ignoreUnreadableDirs = (bool) $ignore;
  40489. return $this;
  40490. }
  40491. public function in($dirs)
  40492. {
  40493. $resolvedDirs = array();
  40494. foreach ((array) $dirs as $dir) {
  40495. if (is_dir($dir)) {
  40496. $resolvedDirs[] = $dir;
  40497. } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  40498. $resolvedDirs = array_merge($resolvedDirs, $glob);
  40499. } else {
  40500. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  40501. }
  40502. }
  40503. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  40504. return $this;
  40505. }
  40506. public function getIterator()
  40507. {
  40508. if (0 === count($this->dirs) && 0 === count($this->iterators)) {
  40509. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  40510. }
  40511. if (1 === count($this->dirs) && 0 === count($this->iterators)) {
  40512. return $this->searchInDirectory($this->dirs[0]);
  40513. }
  40514. $iterator = new \AppendIterator();
  40515. foreach ($this->dirs as $dir) {
  40516. $iterator->append($this->searchInDirectory($dir));
  40517. }
  40518. foreach ($this->iterators as $it) {
  40519. $iterator->append($it);
  40520. }
  40521. return $iterator;
  40522. }
  40523. public function append($iterator)
  40524. {
  40525. if ($iterator instanceof \IteratorAggregate) {
  40526. $this->iterators[] = $iterator->getIterator();
  40527. } elseif ($iterator instanceof \Iterator) {
  40528. $this->iterators[] = $iterator;
  40529. } elseif ($iterator instanceof \Traversable || is_array($iterator)) {
  40530. $it = new \ArrayIterator();
  40531. foreach ($iterator as $file) {
  40532. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  40533. }
  40534. $this->iterators[] = $it;
  40535. } else {
  40536. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  40537. }
  40538. return $this;
  40539. }
  40540. public function count()
  40541. {
  40542. return iterator_count($this->getIterator());
  40543. }
  40544. private function sortAdapters()
  40545. {
  40546. uasort($this->adapters, function (array $a, array $b) {
  40547. if ($a['selected'] || $b['selected']) {
  40548. return $a['selected'] ? -1 : 1;
  40549. }
  40550. return $a['priority'] > $b['priority'] ? -1 : 1;
  40551. });
  40552. return $this;
  40553. }
  40554. private function searchInDirectory($dir)
  40555. {
  40556. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  40557. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  40558. }
  40559. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  40560. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  40561. }
  40562. if ($this->adapters) {
  40563. foreach ($this->adapters as $adapter) {
  40564. if ($adapter['adapter']->isSupported()) {
  40565. try {
  40566. return $this
  40567. ->buildAdapter($adapter['adapter'])
  40568. ->searchInDirectory($dir);
  40569. } catch (ExceptionInterface $e) {
  40570. }
  40571. }
  40572. }
  40573. }
  40574. $minDepth = 0;
  40575. $maxDepth = PHP_INT_MAX;
  40576. foreach ($this->depths as $comparator) {
  40577. switch ($comparator->getOperator()) {
  40578. case '>':
  40579. $minDepth = $comparator->getTarget() + 1;
  40580. break;
  40581. case '>=':
  40582. $minDepth = $comparator->getTarget();
  40583. break;
  40584. case '<':
  40585. $maxDepth = $comparator->getTarget() - 1;
  40586. break;
  40587. case '<=':
  40588. $maxDepth = $comparator->getTarget();
  40589. break;
  40590. default:
  40591. $minDepth = $maxDepth = $comparator->getTarget();
  40592. }
  40593. }
  40594. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  40595. if ($this->followLinks) {
  40596. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  40597. }
  40598. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  40599. if ($this->exclude) {
  40600. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  40601. }
  40602. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  40603. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  40604. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  40605. }
  40606. if ($this->mode) {
  40607. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  40608. }
  40609. if ($this->names || $this->notNames) {
  40610. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  40611. }
  40612. if ($this->contains || $this->notContains) {
  40613. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  40614. }
  40615. if ($this->sizes) {
  40616. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  40617. }
  40618. if ($this->dates) {
  40619. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  40620. }
  40621. if ($this->filters) {
  40622. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  40623. }
  40624. if ($this->paths || $this->notPaths) {
  40625. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  40626. }
  40627. if ($this->sort) {
  40628. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  40629. $iterator = $iteratorAggregate->getIterator();
  40630. }
  40631. return $iterator;
  40632. }
  40633. private function buildAdapter(AdapterInterface $adapter)
  40634. {
  40635. return $adapter
  40636. ->setFollowLinks($this->followLinks)
  40637. ->setDepths($this->depths)
  40638. ->setMode($this->mode)
  40639. ->setExclude($this->exclude)
  40640. ->setNames($this->names)
  40641. ->setNotNames($this->notNames)
  40642. ->setContains($this->contains)
  40643. ->setNotContains($this->notContains)
  40644. ->setSizes($this->sizes)
  40645. ->setDates($this->dates)
  40646. ->setFilters($this->filters)
  40647. ->setSort($this->sort)
  40648. ->setPath($this->paths)
  40649. ->setNotPath($this->notPaths)
  40650. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  40651. }
  40652. private function resetAdapterSelection()
  40653. {
  40654. $this->adapters = array_map(function (array $properties) {
  40655. $properties['selected'] = false;
  40656. return $properties;
  40657. }, $this->adapters);
  40658. }
  40659. private function initDefaultAdapters()
  40660. {
  40661. if (null === $this->adapters) {
  40662. $this->adapters = array();
  40663. $this
  40664. ->addAdapter(new GnuFindAdapter())
  40665. ->addAdapter(new BsdFindAdapter())
  40666. ->addAdapter(new PhpAdapter(), -50)
  40667. ->setAdapter('php')
  40668. ;
  40669. }
  40670. }
  40671. }
  40672. <?php
  40673. namespace Symfony\Component\Finder;
  40674. class Glob
  40675. {
  40676. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  40677. {
  40678. $firstByte = true;
  40679. $escaping = false;
  40680. $inCurlies = 0;
  40681. $regex = '';
  40682. $sizeGlob = strlen($glob);
  40683. for ($i = 0; $i < $sizeGlob; ++$i) {
  40684. $car = $glob[$i];
  40685. if ($firstByte) {
  40686. if ($strictLeadingDot && '.' !== $car) {
  40687. $regex .= '(?=[^\.])';
  40688. }
  40689. $firstByte = false;
  40690. }
  40691. if ('/' === $car) {
  40692. $firstByte = true;
  40693. }
  40694. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  40695. $regex .= "\\$car";
  40696. } elseif ('*' === $car) {
  40697. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  40698. } elseif ('?' === $car) {
  40699. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  40700. } elseif ('{' === $car) {
  40701. $regex .= $escaping ? '\\{' : '(';
  40702. if (!$escaping) {
  40703. ++$inCurlies;
  40704. }
  40705. } elseif ('}' === $car && $inCurlies) {
  40706. $regex .= $escaping ? '}' : ')';
  40707. if (!$escaping) {
  40708. --$inCurlies;
  40709. }
  40710. } elseif (',' === $car && $inCurlies) {
  40711. $regex .= $escaping ? ',' : '|';
  40712. } elseif ('\\' === $car) {
  40713. if ($escaping) {
  40714. $regex .= '\\\\';
  40715. $escaping = false;
  40716. } else {
  40717. $escaping = true;
  40718. }
  40719. continue;
  40720. } else {
  40721. $regex .= $car;
  40722. }
  40723. $escaping = false;
  40724. }
  40725. return $delimiter.'^'.$regex.'$'.$delimiter;
  40726. }
  40727. }
  40728. <?php
  40729. namespace Symfony\Component\Finder\Iterator;
  40730. class CustomFilterIterator extends FilterIterator
  40731. {
  40732. private $filters = array();
  40733. public function __construct(\Iterator $iterator, array $filters)
  40734. {
  40735. foreach ($filters as $filter) {
  40736. if (!is_callable($filter)) {
  40737. throw new \InvalidArgumentException('Invalid PHP callback.');
  40738. }
  40739. }
  40740. $this->filters = $filters;
  40741. parent::__construct($iterator);
  40742. }
  40743. public function accept()
  40744. {
  40745. $fileinfo = $this->current();
  40746. foreach ($this->filters as $filter) {
  40747. if (false === call_user_func($filter, $fileinfo)) {
  40748. return false;
  40749. }
  40750. }
  40751. return true;
  40752. }
  40753. }
  40754. <?php
  40755. namespace Symfony\Component\Finder\Iterator;
  40756. use Symfony\Component\Finder\Comparator\DateComparator;
  40757. class DateRangeFilterIterator extends FilterIterator
  40758. {
  40759. private $comparators = array();
  40760. public function __construct(\Iterator $iterator, array $comparators)
  40761. {
  40762. $this->comparators = $comparators;
  40763. parent::__construct($iterator);
  40764. }
  40765. public function accept()
  40766. {
  40767. $fileinfo = $this->current();
  40768. if (!file_exists($fileinfo->getPathname())) {
  40769. return false;
  40770. }
  40771. $filedate = $fileinfo->getMTime();
  40772. foreach ($this->comparators as $compare) {
  40773. if (!$compare->test($filedate)) {
  40774. return false;
  40775. }
  40776. }
  40777. return true;
  40778. }
  40779. }
  40780. <?php
  40781. namespace Symfony\Component\Finder\Iterator;
  40782. class DepthRangeFilterIterator extends FilterIterator
  40783. {
  40784. private $minDepth = 0;
  40785. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  40786. {
  40787. $this->minDepth = $minDepth;
  40788. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  40789. parent::__construct($iterator);
  40790. }
  40791. public function accept()
  40792. {
  40793. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  40794. }
  40795. }
  40796. <?php
  40797. namespace Symfony\Component\Finder\Iterator;
  40798. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  40799. {
  40800. private $iterator;
  40801. private $isRecursive;
  40802. private $excludedDirs = array();
  40803. private $excludedPattern;
  40804. public function __construct(\Iterator $iterator, array $directories)
  40805. {
  40806. $this->iterator = $iterator;
  40807. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  40808. $patterns = array();
  40809. foreach ($directories as $directory) {
  40810. $directory = rtrim($directory, '/');
  40811. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  40812. $patterns[] = preg_quote($directory, '#');
  40813. } else {
  40814. $this->excludedDirs[$directory] = true;
  40815. }
  40816. }
  40817. if ($patterns) {
  40818. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  40819. }
  40820. parent::__construct($iterator);
  40821. }
  40822. public function accept()
  40823. {
  40824. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  40825. return false;
  40826. }
  40827. if ($this->excludedPattern) {
  40828. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  40829. $path = str_replace('\\', '/', $path);
  40830. return !preg_match($this->excludedPattern, $path);
  40831. }
  40832. return true;
  40833. }
  40834. public function hasChildren()
  40835. {
  40836. return $this->isRecursive && $this->iterator->hasChildren();
  40837. }
  40838. public function getChildren()
  40839. {
  40840. $children = new self($this->iterator->getChildren(), array());
  40841. $children->excludedDirs = $this->excludedDirs;
  40842. $children->excludedPattern = $this->excludedPattern;
  40843. return $children;
  40844. }
  40845. }
  40846. <?php
  40847. namespace Symfony\Component\Finder\Iterator;
  40848. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40849. use Symfony\Component\Finder\SplFileInfo;
  40850. class FilePathsIterator extends \ArrayIterator
  40851. {
  40852. private $baseDir;
  40853. private $baseDirLength;
  40854. private $subPath;
  40855. private $subPathname;
  40856. private $current;
  40857. public function __construct(array $paths, $baseDir)
  40858. {
  40859. $this->baseDir = $baseDir;
  40860. $this->baseDirLength = strlen($baseDir);
  40861. parent::__construct($paths);
  40862. }
  40863. public function __call($name, array $arguments)
  40864. {
  40865. return call_user_func_array(array($this->current(), $name), $arguments);
  40866. }
  40867. public function current()
  40868. {
  40869. return $this->current;
  40870. }
  40871. public function key()
  40872. {
  40873. return $this->current->getPathname();
  40874. }
  40875. public function next()
  40876. {
  40877. parent::next();
  40878. $this->buildProperties();
  40879. }
  40880. public function rewind()
  40881. {
  40882. parent::rewind();
  40883. $this->buildProperties();
  40884. }
  40885. public function getSubPath()
  40886. {
  40887. return $this->subPath;
  40888. }
  40889. public function getSubPathname()
  40890. {
  40891. return $this->subPathname;
  40892. }
  40893. private function buildProperties()
  40894. {
  40895. $absolutePath = parent::current();
  40896. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  40897. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  40898. $dir = dirname($this->subPathname);
  40899. $this->subPath = '.' === $dir ? '' : $dir;
  40900. } else {
  40901. $this->subPath = $this->subPathname = '';
  40902. }
  40903. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  40904. }
  40905. }
  40906. <?php
  40907. namespace Symfony\Component\Finder\Iterator;
  40908. class FileTypeFilterIterator extends FilterIterator
  40909. {
  40910. const ONLY_FILES = 1;
  40911. const ONLY_DIRECTORIES = 2;
  40912. private $mode;
  40913. public function __construct(\Iterator $iterator, $mode)
  40914. {
  40915. $this->mode = $mode;
  40916. parent::__construct($iterator);
  40917. }
  40918. public function accept()
  40919. {
  40920. $fileinfo = $this->current();
  40921. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  40922. return false;
  40923. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  40924. return false;
  40925. }
  40926. return true;
  40927. }
  40928. }
  40929. <?php
  40930. namespace Symfony\Component\Finder\Iterator;
  40931. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  40932. {
  40933. public function accept()
  40934. {
  40935. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  40936. return true;
  40937. }
  40938. $fileinfo = $this->current();
  40939. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  40940. return false;
  40941. }
  40942. $content = $fileinfo->getContents();
  40943. if (!$content) {
  40944. return false;
  40945. }
  40946. return $this->isAccepted($content);
  40947. }
  40948. protected function toRegex($str)
  40949. {
  40950. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  40951. }
  40952. }
  40953. <?php
  40954. namespace Symfony\Component\Finder\Iterator;
  40955. use Symfony\Component\Finder\Glob;
  40956. class FilenameFilterIterator extends MultiplePcreFilterIterator
  40957. {
  40958. public function accept()
  40959. {
  40960. return $this->isAccepted($this->current()->getFilename());
  40961. }
  40962. protected function toRegex($str)
  40963. {
  40964. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  40965. }
  40966. }
  40967. <?php
  40968. namespace Symfony\Component\Finder\Iterator;
  40969. abstract class FilterIterator extends \FilterIterator
  40970. {
  40971. public function rewind()
  40972. {
  40973. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  40974. parent::rewind();
  40975. return;
  40976. }
  40977. $iterator = $this;
  40978. while ($iterator instanceof \OuterIterator) {
  40979. $innerIterator = $iterator->getInnerIterator();
  40980. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  40981. if ($innerIterator->isRewindable()) {
  40982. $innerIterator->next();
  40983. $innerIterator->rewind();
  40984. }
  40985. } elseif ($innerIterator instanceof \FilesystemIterator) {
  40986. $innerIterator->next();
  40987. $innerIterator->rewind();
  40988. }
  40989. $iterator = $innerIterator;
  40990. }
  40991. parent::rewind();
  40992. }
  40993. }
  40994. <?php
  40995. namespace Symfony\Component\Finder\Iterator;
  40996. abstract class MultiplePcreFilterIterator extends FilterIterator
  40997. {
  40998. protected $matchRegexps = array();
  40999. protected $noMatchRegexps = array();
  41000. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  41001. {
  41002. foreach ($matchPatterns as $pattern) {
  41003. $this->matchRegexps[] = $this->toRegex($pattern);
  41004. }
  41005. foreach ($noMatchPatterns as $pattern) {
  41006. $this->noMatchRegexps[] = $this->toRegex($pattern);
  41007. }
  41008. parent::__construct($iterator);
  41009. }
  41010. protected function isAccepted($string)
  41011. {
  41012. foreach ($this->noMatchRegexps as $regex) {
  41013. if (preg_match($regex, $string)) {
  41014. return false;
  41015. }
  41016. }
  41017. if ($this->matchRegexps) {
  41018. foreach ($this->matchRegexps as $regex) {
  41019. if (preg_match($regex, $string)) {
  41020. return true;
  41021. }
  41022. }
  41023. return false;
  41024. }
  41025. return true;
  41026. }
  41027. protected function isRegex($str)
  41028. {
  41029. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  41030. $start = substr($m[1], 0, 1);
  41031. $end = substr($m[1], -1);
  41032. if ($start === $end) {
  41033. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  41034. }
  41035. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  41036. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  41037. return true;
  41038. }
  41039. }
  41040. }
  41041. return false;
  41042. }
  41043. abstract protected function toRegex($str);
  41044. }
  41045. <?php
  41046. namespace Symfony\Component\Finder\Iterator;
  41047. class PathFilterIterator extends MultiplePcreFilterIterator
  41048. {
  41049. public function accept()
  41050. {
  41051. $filename = $this->current()->getRelativePathname();
  41052. if ('\\' === DIRECTORY_SEPARATOR) {
  41053. $filename = str_replace('\\', '/', $filename);
  41054. }
  41055. return $this->isAccepted($filename);
  41056. }
  41057. protected function toRegex($str)
  41058. {
  41059. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  41060. }
  41061. }
  41062. <?php
  41063. namespace Symfony\Component\Finder\Iterator;
  41064. use Symfony\Component\Finder\Exception\AccessDeniedException;
  41065. use Symfony\Component\Finder\SplFileInfo;
  41066. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  41067. {
  41068. private $ignoreUnreadableDirs;
  41069. private $rewindable;
  41070. private $rootPath;
  41071. private $subPath;
  41072. private $directorySeparator = '/';
  41073. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  41074. {
  41075. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  41076. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  41077. }
  41078. parent::__construct($path, $flags);
  41079. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  41080. $this->rootPath = (string) $path;
  41081. if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  41082. $this->directorySeparator = DIRECTORY_SEPARATOR;
  41083. }
  41084. }
  41085. public function current()
  41086. {
  41087. if (null === $subPathname = $this->subPath) {
  41088. $subPathname = $this->subPath = (string) $this->getSubPath();
  41089. }
  41090. if ('' !== $subPathname) {
  41091. $subPathname .= $this->directorySeparator;
  41092. }
  41093. $subPathname .= $this->getFilename();
  41094. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  41095. }
  41096. public function getChildren()
  41097. {
  41098. try {
  41099. $children = parent::getChildren();
  41100. if ($children instanceof self) {
  41101. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  41102. $children->rewindable = &$this->rewindable;
  41103. $children->rootPath = $this->rootPath;
  41104. }
  41105. return $children;
  41106. } catch (\UnexpectedValueException $e) {
  41107. if ($this->ignoreUnreadableDirs) {
  41108. return new \RecursiveArrayIterator(array());
  41109. } else {
  41110. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  41111. }
  41112. }
  41113. }
  41114. public function rewind()
  41115. {
  41116. if (false === $this->isRewindable()) {
  41117. return;
  41118. }
  41119. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  41120. parent::next();
  41121. }
  41122. parent::rewind();
  41123. }
  41124. public function isRewindable()
  41125. {
  41126. if (null !== $this->rewindable) {
  41127. return $this->rewindable;
  41128. }
  41129. if ('' === $this->getPath()) {
  41130. return $this->rewindable = false;
  41131. }
  41132. if (false !== $stream = @opendir($this->getPath())) {
  41133. $infos = stream_get_meta_data($stream);
  41134. closedir($stream);
  41135. if ($infos['seekable']) {
  41136. return $this->rewindable = true;
  41137. }
  41138. }
  41139. return $this->rewindable = false;
  41140. }
  41141. }
  41142. <?php
  41143. namespace Symfony\Component\Finder\Iterator;
  41144. use Symfony\Component\Finder\Comparator\NumberComparator;
  41145. class SizeRangeFilterIterator extends FilterIterator
  41146. {
  41147. private $comparators = array();
  41148. public function __construct(\Iterator $iterator, array $comparators)
  41149. {
  41150. $this->comparators = $comparators;
  41151. parent::__construct($iterator);
  41152. }
  41153. public function accept()
  41154. {
  41155. $fileinfo = $this->current();
  41156. if (!$fileinfo->isFile()) {
  41157. return true;
  41158. }
  41159. $filesize = $fileinfo->getSize();
  41160. foreach ($this->comparators as $compare) {
  41161. if (!$compare->test($filesize)) {
  41162. return false;
  41163. }
  41164. }
  41165. return true;
  41166. }
  41167. }
  41168. <?php
  41169. namespace Symfony\Component\Finder\Iterator;
  41170. class SortableIterator implements \IteratorAggregate
  41171. {
  41172. const SORT_BY_NAME = 1;
  41173. const SORT_BY_TYPE = 2;
  41174. const SORT_BY_ACCESSED_TIME = 3;
  41175. const SORT_BY_CHANGED_TIME = 4;
  41176. const SORT_BY_MODIFIED_TIME = 5;
  41177. private $iterator;
  41178. private $sort;
  41179. public function __construct(\Traversable $iterator, $sort)
  41180. {
  41181. $this->iterator = $iterator;
  41182. if (self::SORT_BY_NAME === $sort) {
  41183. $this->sort = function ($a, $b) {
  41184. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  41185. };
  41186. } elseif (self::SORT_BY_TYPE === $sort) {
  41187. $this->sort = function ($a, $b) {
  41188. if ($a->isDir() && $b->isFile()) {
  41189. return -1;
  41190. } elseif ($a->isFile() && $b->isDir()) {
  41191. return 1;
  41192. }
  41193. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  41194. };
  41195. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  41196. $this->sort = function ($a, $b) {
  41197. return $a->getATime() - $b->getATime();
  41198. };
  41199. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  41200. $this->sort = function ($a, $b) {
  41201. return $a->getCTime() - $b->getCTime();
  41202. };
  41203. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  41204. $this->sort = function ($a, $b) {
  41205. return $a->getMTime() - $b->getMTime();
  41206. };
  41207. } elseif (is_callable($sort)) {
  41208. $this->sort = $sort;
  41209. } else {
  41210. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  41211. }
  41212. }
  41213. public function getIterator()
  41214. {
  41215. $array = iterator_to_array($this->iterator, true);
  41216. uasort($array, $this->sort);
  41217. return new \ArrayIterator($array);
  41218. }
  41219. }
  41220. Copyright (c) 2004-2017 Fabien Potencier
  41221. Permission is hereby granted, free of charge, to any person obtaining a copy
  41222. of this software and associated documentation files (the "Software"), to deal
  41223. in the Software without restriction, including without limitation the rights
  41224. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41225. copies of the Software, and to permit persons to whom the Software is furnished
  41226. to do so, subject to the following conditions:
  41227. The above copyright notice and this permission notice shall be included in all
  41228. copies or substantial portions of the Software.
  41229. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41230. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41231. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41232. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41233. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41234. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41235. THE SOFTWARE.
  41236. <?php
  41237. namespace Symfony\Component\Finder\Shell;
  41238. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41239. class Command
  41240. {
  41241. private $parent;
  41242. private $bits = array();
  41243. private $labels = array();
  41244. private $errorHandler;
  41245. public function __construct(Command $parent = null)
  41246. {
  41247. $this->parent = $parent;
  41248. }
  41249. public function __toString()
  41250. {
  41251. return $this->join();
  41252. }
  41253. public static function create(Command $parent = null)
  41254. {
  41255. return new self($parent);
  41256. }
  41257. public static function escape($input)
  41258. {
  41259. return escapeshellcmd($input);
  41260. }
  41261. public static function quote($input)
  41262. {
  41263. return escapeshellarg($input);
  41264. }
  41265. public function add($bit)
  41266. {
  41267. $this->bits[] = $bit;
  41268. return $this;
  41269. }
  41270. public function top($bit)
  41271. {
  41272. array_unshift($this->bits, $bit);
  41273. foreach ($this->labels as $label => $index) {
  41274. $this->labels[$label] += 1;
  41275. }
  41276. return $this;
  41277. }
  41278. public function arg($arg)
  41279. {
  41280. $this->bits[] = self::quote($arg);
  41281. return $this;
  41282. }
  41283. public function cmd($esc)
  41284. {
  41285. $this->bits[] = self::escape($esc);
  41286. return $this;
  41287. }
  41288. public function ins($label)
  41289. {
  41290. if (isset($this->labels[$label])) {
  41291. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  41292. }
  41293. $this->bits[] = self::create($this);
  41294. $this->labels[$label] = count($this->bits) - 1;
  41295. return $this->bits[$this->labels[$label]];
  41296. }
  41297. public function get($label)
  41298. {
  41299. if (!isset($this->labels[$label])) {
  41300. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  41301. }
  41302. return $this->bits[$this->labels[$label]];
  41303. }
  41304. public function end()
  41305. {
  41306. if (null === $this->parent) {
  41307. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  41308. }
  41309. return $this->parent;
  41310. }
  41311. public function length()
  41312. {
  41313. return count($this->bits);
  41314. }
  41315. public function setErrorHandler(\Closure $errorHandler)
  41316. {
  41317. $this->errorHandler = $errorHandler;
  41318. return $this;
  41319. }
  41320. public function getErrorHandler()
  41321. {
  41322. return $this->errorHandler;
  41323. }
  41324. public function execute()
  41325. {
  41326. if (null === $errorHandler = $this->errorHandler) {
  41327. exec($this->join(), $output);
  41328. } else {
  41329. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  41330. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  41331. if ($error = stream_get_contents($pipes[2])) {
  41332. $errorHandler($error);
  41333. }
  41334. proc_close($process);
  41335. }
  41336. return $output ?: array();
  41337. }
  41338. public function join()
  41339. {
  41340. return implode(' ', array_filter(
  41341. array_map(function ($bit) {
  41342. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  41343. }, $this->bits),
  41344. function ($bit) { return null !== $bit; }
  41345. ));
  41346. }
  41347. public function addAtIndex($bit, $index)
  41348. {
  41349. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  41350. return $this;
  41351. }
  41352. }
  41353. <?php
  41354. namespace Symfony\Component\Finder\Shell;
  41355. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41356. class Shell
  41357. {
  41358. const TYPE_UNIX = 1;
  41359. const TYPE_DARWIN = 2;
  41360. const TYPE_CYGWIN = 3;
  41361. const TYPE_WINDOWS = 4;
  41362. const TYPE_BSD = 5;
  41363. private $type;
  41364. public function getType()
  41365. {
  41366. if (null === $this->type) {
  41367. $this->type = $this->guessType();
  41368. }
  41369. return $this->type;
  41370. }
  41371. public function testCommand($command)
  41372. {
  41373. if (!function_exists('exec')) {
  41374. return false;
  41375. }
  41376. $testCommand = 'which ';
  41377. if (self::TYPE_WINDOWS === $this->type) {
  41378. $testCommand = 'where ';
  41379. }
  41380. $command = escapeshellcmd($command);
  41381. exec($testCommand.$command, $output, $code);
  41382. return 0 === $code && count($output) > 0;
  41383. }
  41384. private function guessType()
  41385. {
  41386. $os = strtolower(PHP_OS);
  41387. if (false !== strpos($os, 'cygwin')) {
  41388. return self::TYPE_CYGWIN;
  41389. }
  41390. if (false !== strpos($os, 'darwin')) {
  41391. return self::TYPE_DARWIN;
  41392. }
  41393. if (false !== strpos($os, 'bsd')) {
  41394. return self::TYPE_BSD;
  41395. }
  41396. if (0 === strpos($os, 'win')) {
  41397. return self::TYPE_WINDOWS;
  41398. }
  41399. return self::TYPE_UNIX;
  41400. }
  41401. }
  41402. <?php
  41403. namespace Symfony\Component\Finder;
  41404. class SplFileInfo extends \SplFileInfo
  41405. {
  41406. private $relativePath;
  41407. private $relativePathname;
  41408. public function __construct($file, $relativePath, $relativePathname)
  41409. {
  41410. parent::__construct($file);
  41411. $this->relativePath = $relativePath;
  41412. $this->relativePathname = $relativePathname;
  41413. }
  41414. public function getRelativePath()
  41415. {
  41416. return $this->relativePath;
  41417. }
  41418. public function getRelativePathname()
  41419. {
  41420. return $this->relativePathname;
  41421. }
  41422. public function getContents()
  41423. {
  41424. $level = error_reporting(0);
  41425. $content = file_get_contents($this->getPathname());
  41426. error_reporting($level);
  41427. if (false === $content) {
  41428. $error = error_get_last();
  41429. throw new \RuntimeException($error['message']);
  41430. }
  41431. return $content;
  41432. }
  41433. }
  41434. Copyright (c) 2014-2016 Fabien Potencier
  41435. Permission is hereby granted, free of charge, to any person obtaining a copy
  41436. of this software and associated documentation files (the "Software"), to deal
  41437. in the Software without restriction, including without limitation the rights
  41438. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41439. copies of the Software, and to permit persons to whom the Software is furnished
  41440. to do so, subject to the following conditions:
  41441. The above copyright notice and this permission notice shall be included in all
  41442. copies or substantial portions of the Software.
  41443. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41444. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41445. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41446. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41447. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41448. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41449. THE SOFTWARE.
  41450. <?php
  41451. namespace Symfony\Polyfill\Mbstring;
  41452. final class Mbstring
  41453. {
  41454. const MB_CASE_FOLD = PHP_INT_MAX;
  41455. private static $encodingList = array('ASCII', 'UTF-8');
  41456. private static $language = 'neutral';
  41457. private static $internalEncoding = 'UTF-8';
  41458. private static $caseFold = array(
  41459. array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"),
  41460. array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1",'ι'),
  41461. );
  41462. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  41463. {
  41464. if (is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  41465. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  41466. } else {
  41467. $fromEncoding = self::getEncoding($fromEncoding);
  41468. }
  41469. $toEncoding = self::getEncoding($toEncoding);
  41470. if ('BASE64' === $fromEncoding) {
  41471. $s = base64_decode($s);
  41472. $fromEncoding = $toEncoding;
  41473. }
  41474. if ('BASE64' === $toEncoding) {
  41475. return base64_encode($s);
  41476. }
  41477. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  41478. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  41479. $fromEncoding = 'Windows-1252';
  41480. }
  41481. if ('UTF-8' !== $fromEncoding) {
  41482. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  41483. }
  41484. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  41485. }
  41486. if ('HTML-ENTITIES' === $fromEncoding) {
  41487. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  41488. $fromEncoding = 'UTF-8';
  41489. }
  41490. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  41491. }
  41492. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  41493. {
  41494. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  41495. $ok = true;
  41496. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  41497. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  41498. $ok = false;
  41499. }
  41500. });
  41501. return $ok ? $fromEncoding : false;
  41502. }
  41503. public static function mb_decode_mimeheader($s)
  41504. {
  41505. return iconv_mime_decode($s, 2, self::$internalEncoding);
  41506. }
  41507. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  41508. {
  41509. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  41510. }
  41511. public static function mb_convert_case($s, $mode, $encoding = null)
  41512. {
  41513. if ('' === $s .= '') {
  41514. return '';
  41515. }
  41516. $encoding = self::getEncoding($encoding);
  41517. if ('UTF-8' === $encoding) {
  41518. $encoding = null;
  41519. if (!preg_match('//u', $s)) {
  41520. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  41521. }
  41522. } else {
  41523. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  41524. }
  41525. if (MB_CASE_TITLE == $mode) {
  41526. $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s);
  41527. $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);
  41528. } else {
  41529. if (MB_CASE_UPPER == $mode) {
  41530. static $upper = null;
  41531. if (null === $upper) {
  41532. $upper = self::getData('upperCase');
  41533. }
  41534. $map = $upper;
  41535. } else {
  41536. if (self::MB_CASE_FOLD === $mode) {
  41537. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  41538. }
  41539. static $lower = null;
  41540. if (null === $lower) {
  41541. $lower = self::getData('lowerCase');
  41542. }
  41543. $map = $lower;
  41544. }
  41545. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  41546. $i = 0;
  41547. $len = strlen($s);
  41548. while ($i < $len) {
  41549. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  41550. $uchr = substr($s, $i, $ulen);
  41551. $i += $ulen;
  41552. if (isset($map[$uchr])) {
  41553. $uchr = $map[$uchr];
  41554. $nlen = strlen($uchr);
  41555. if ($nlen == $ulen) {
  41556. $nlen = $i;
  41557. do {
  41558. $s[--$nlen] = $uchr[--$ulen];
  41559. } while ($ulen);
  41560. } else {
  41561. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  41562. $len += $nlen - $ulen;
  41563. $i += $nlen - $ulen;
  41564. }
  41565. }
  41566. }
  41567. }
  41568. if (null === $encoding) {
  41569. return $s;
  41570. }
  41571. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  41572. }
  41573. public static function mb_internal_encoding($encoding = null)
  41574. {
  41575. if (null === $encoding) {
  41576. return self::$internalEncoding;
  41577. }
  41578. $encoding = self::getEncoding($encoding);
  41579. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  41580. self::$internalEncoding = $encoding;
  41581. return true;
  41582. }
  41583. return false;
  41584. }
  41585. public static function mb_language($lang = null)
  41586. {
  41587. if (null === $lang) {
  41588. return self::$language;
  41589. }
  41590. switch ($lang = strtolower($lang)) {
  41591. case 'uni':
  41592. case 'neutral':
  41593. self::$language = $lang;
  41594. return true;
  41595. }
  41596. return false;
  41597. }
  41598. public static function mb_list_encodings()
  41599. {
  41600. return array('UTF-8');
  41601. }
  41602. public static function mb_encoding_aliases($encoding)
  41603. {
  41604. switch (strtoupper($encoding)) {
  41605. case 'UTF8':
  41606. case 'UTF-8':
  41607. return array('utf8');
  41608. }
  41609. return false;
  41610. }
  41611. public static function mb_check_encoding($var = null, $encoding = null)
  41612. {
  41613. if (null === $encoding) {
  41614. if (null === $var) {
  41615. return false;
  41616. }
  41617. $encoding = self::$internalEncoding;
  41618. }
  41619. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  41620. }
  41621. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  41622. {
  41623. if (null === $encodingList) {
  41624. $encodingList = self::$encodingList;
  41625. } else {
  41626. if (!is_array($encodingList)) {
  41627. $encodingList = array_map('trim', explode(',', $encodingList));
  41628. }
  41629. $encodingList = array_map('strtoupper', $encodingList);
  41630. }
  41631. foreach ($encodingList as $enc) {
  41632. switch ($enc) {
  41633. case 'ASCII':
  41634. if (!preg_match('/[\x80-\xFF]/', $str)) {
  41635. return $enc;
  41636. }
  41637. break;
  41638. case 'UTF8':
  41639. case 'UTF-8':
  41640. if (preg_match('//u', $str)) {
  41641. return 'UTF-8';
  41642. }
  41643. break;
  41644. default:
  41645. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  41646. return $enc;
  41647. }
  41648. }
  41649. }
  41650. return false;
  41651. }
  41652. public static function mb_detect_order($encodingList = null)
  41653. {
  41654. if (null === $encodingList) {
  41655. return self::$encodingList;
  41656. }
  41657. if (!is_array($encodingList)) {
  41658. $encodingList = array_map('trim', explode(',', $encodingList));
  41659. }
  41660. $encodingList = array_map('strtoupper', $encodingList);
  41661. foreach ($encodingList as $enc) {
  41662. switch ($enc) {
  41663. default:
  41664. if (strncmp($enc, 'ISO-8859-', 9)) {
  41665. return false;
  41666. }
  41667. case 'ASCII':
  41668. case 'UTF8':
  41669. case 'UTF-8':
  41670. }
  41671. }
  41672. self::$encodingList = $encodingList;
  41673. return true;
  41674. }
  41675. public static function mb_strlen($s, $encoding = null)
  41676. {
  41677. $encoding = self::getEncoding($encoding);
  41678. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41679. return strlen($s);
  41680. }
  41681. return @iconv_strlen($s, $encoding);
  41682. }
  41683. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  41684. {
  41685. $encoding = self::getEncoding($encoding);
  41686. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41687. return strpos($haystack, $needle, $offset);
  41688. }
  41689. if ('' === $needle .= '') {
  41690. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  41691. return false;
  41692. }
  41693. return iconv_strpos($haystack, $needle, $offset, $encoding);
  41694. }
  41695. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  41696. {
  41697. $encoding = self::getEncoding($encoding);
  41698. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41699. return strrpos($haystack, $needle, $offset);
  41700. }
  41701. if ($offset != (int) $offset) {
  41702. $offset = 0;
  41703. } elseif ($offset = (int) $offset) {
  41704. if ($offset < 0) {
  41705. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  41706. $offset = 0;
  41707. } else {
  41708. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  41709. }
  41710. }
  41711. $pos = iconv_strrpos($haystack, $needle, $encoding);
  41712. return false !== $pos ? $offset + $pos : false;
  41713. }
  41714. public static function mb_strtolower($s, $encoding = null)
  41715. {
  41716. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  41717. }
  41718. public static function mb_strtoupper($s, $encoding = null)
  41719. {
  41720. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  41721. }
  41722. public static function mb_substitute_character($c = null)
  41723. {
  41724. if (0 === strcasecmp($c, 'none')) {
  41725. return true;
  41726. }
  41727. return null !== $c ? false : 'none';
  41728. }
  41729. public static function mb_substr($s, $start, $length = null, $encoding = null)
  41730. {
  41731. $encoding = self::getEncoding($encoding);
  41732. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41733. return substr($s, $start, null === $length ? 2147483647 : $length);
  41734. }
  41735. if ($start < 0) {
  41736. $start = iconv_strlen($s, $encoding) + $start;
  41737. if ($start < 0) {
  41738. $start = 0;
  41739. }
  41740. }
  41741. if (null === $length) {
  41742. $length = 2147483647;
  41743. } elseif ($length < 0) {
  41744. $length = iconv_strlen($s, $encoding) + $length - $start;
  41745. if ($length < 0) {
  41746. return '';
  41747. }
  41748. }
  41749. return iconv_substr($s, $start, $length, $encoding).'';
  41750. }
  41751. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  41752. {
  41753. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  41754. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  41755. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  41756. }
  41757. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  41758. {
  41759. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  41760. return self::getSubpart($pos, $part, $haystack, $encoding);
  41761. }
  41762. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  41763. {
  41764. $encoding = self::getEncoding($encoding);
  41765. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41766. return strrchr($haystack, $needle, $part);
  41767. }
  41768. $needle = self::mb_substr($needle, 0, 1, $encoding);
  41769. $pos = iconv_strrpos($haystack, $needle, $encoding);
  41770. return self::getSubpart($pos, $part, $haystack, $encoding);
  41771. }
  41772. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  41773. {
  41774. $needle = self::mb_substr($needle, 0, 1, $encoding);
  41775. $pos = self::mb_strripos($haystack, $needle, $encoding);
  41776. return self::getSubpart($pos, $part, $haystack, $encoding);
  41777. }
  41778. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  41779. {
  41780. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  41781. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  41782. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  41783. }
  41784. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  41785. {
  41786. $pos = strpos($haystack, $needle);
  41787. if (false === $pos) {
  41788. return false;
  41789. }
  41790. if ($part) {
  41791. return substr($haystack, 0, $pos);
  41792. }
  41793. return substr($haystack, $pos);
  41794. }
  41795. public static function mb_get_info($type = 'all')
  41796. {
  41797. $info = array(
  41798. 'internal_encoding' => self::$internalEncoding,
  41799. 'http_output' => 'pass',
  41800. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  41801. 'func_overload' => 0,
  41802. 'func_overload_list' => 'no overload',
  41803. 'mail_charset' => 'UTF-8',
  41804. 'mail_header_encoding' => 'BASE64',
  41805. 'mail_body_encoding' => 'BASE64',
  41806. 'illegal_chars' => 0,
  41807. 'encoding_translation' => 'Off',
  41808. 'language' => self::$language,
  41809. 'detect_order' => self::$encodingList,
  41810. 'substitute_character' => 'none',
  41811. 'strict_detection' => 'Off',
  41812. );
  41813. if ('all' === $type) {
  41814. return $info;
  41815. }
  41816. if (isset($info[$type])) {
  41817. return $info[$type];
  41818. }
  41819. return false;
  41820. }
  41821. public static function mb_http_input($type = '')
  41822. {
  41823. return false;
  41824. }
  41825. public static function mb_http_output($encoding = null)
  41826. {
  41827. return null !== $encoding ? 'pass' === $encoding : 'pass';
  41828. }
  41829. public static function mb_strwidth($s, $encoding = null)
  41830. {
  41831. $encoding = self::getEncoding($encoding);
  41832. if ('UTF-8' !== $encoding) {
  41833. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  41834. }
  41835. $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);
  41836. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  41837. }
  41838. public static function mb_substr_count($haystack, $needle, $encoding = null)
  41839. {
  41840. return substr_count($haystack, $needle);
  41841. }
  41842. public static function mb_output_handler($contents, $status)
  41843. {
  41844. return $contents;
  41845. }
  41846. public static function mb_chr($code, $encoding = null)
  41847. {
  41848. if (0x80 > $code %= 0x200000) {
  41849. $s = chr($code);
  41850. } elseif (0x800 > $code) {
  41851. $s = chr(0xC0 | $code >> 6).chr(0x80 | $code & 0x3F);
  41852. } elseif (0x10000 > $code) {
  41853. $s = chr(0xE0 | $code >> 12).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F);
  41854. } else {
  41855. $s = chr(0xF0 | $code >> 18).chr(0x80 | $code >> 12 & 0x3F).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F);
  41856. }
  41857. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  41858. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  41859. }
  41860. return $s;
  41861. }
  41862. public static function mb_ord($s, $encoding = null)
  41863. {
  41864. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  41865. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  41866. }
  41867. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  41868. if (0xF0 <= $code) {
  41869. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  41870. }
  41871. if (0xE0 <= $code) {
  41872. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  41873. }
  41874. if (0xC0 <= $code) {
  41875. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  41876. }
  41877. return $code;
  41878. }
  41879. private static function getSubpart($pos, $part, $haystack, $encoding)
  41880. {
  41881. if (false === $pos) {
  41882. return false;
  41883. }
  41884. if ($part) {
  41885. return self::mb_substr($haystack, 0, $pos, $encoding);
  41886. }
  41887. return self::mb_substr($haystack, $pos, null, $encoding);
  41888. }
  41889. private static function html_encoding_callback($m)
  41890. {
  41891. $i = 1;
  41892. $entities = '';
  41893. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  41894. while (isset($m[$i])) {
  41895. if (0x80 > $m[$i]) {
  41896. $entities .= chr($m[$i++]);
  41897. continue;
  41898. }
  41899. if (0xF0 <= $m[$i]) {
  41900. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  41901. } elseif (0xE0 <= $m[$i]) {
  41902. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  41903. } else {
  41904. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  41905. }
  41906. $entities .= '&#'.$c.';';
  41907. }
  41908. return $entities;
  41909. }
  41910. private static function title_case_lower($s)
  41911. {
  41912. return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8');
  41913. }
  41914. private static function title_case_upper($s)
  41915. {
  41916. return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8');
  41917. }
  41918. private static function getData($file)
  41919. {
  41920. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  41921. return require $file;
  41922. }
  41923. return false;
  41924. }
  41925. private static function getEncoding($encoding)
  41926. {
  41927. if (null === $encoding) {
  41928. return self::$internalEncoding;
  41929. }
  41930. $encoding = strtoupper($encoding);
  41931. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  41932. return 'CP850';
  41933. }
  41934. if ('UTF8' === $encoding) {
  41935. return 'UTF-8';
  41936. }
  41937. return $encoding;
  41938. }
  41939. }
  41940. <?php
  41941. static $data = array (
  41942. 'A' => 'a',
  41943. 'B' => 'b',
  41944. 'C' => 'c',
  41945. 'D' => 'd',
  41946. 'E' => 'e',
  41947. 'F' => 'f',
  41948. 'G' => 'g',
  41949. 'H' => 'h',
  41950. 'I' => 'i',
  41951. 'J' => 'j',
  41952. 'K' => 'k',
  41953. 'L' => 'l',
  41954. 'M' => 'm',
  41955. 'N' => 'n',
  41956. 'O' => 'o',
  41957. 'P' => 'p',
  41958. 'Q' => 'q',
  41959. 'R' => 'r',
  41960. 'S' => 's',
  41961. 'T' => 't',
  41962. 'U' => 'u',
  41963. 'V' => 'v',
  41964. 'W' => 'w',
  41965. 'X' => 'x',
  41966. 'Y' => 'y',
  41967. 'Z' => 'z',
  41968. 'À' => 'à',
  41969. '�' => 'á',
  41970. 'Â' => 'â',
  41971. 'Ã' => 'ã',
  41972. 'Ä' => 'ä',
  41973. 'Ã…' => 'Ã¥',
  41974. 'Æ' => 'æ',
  41975. 'Ç' => 'ç',
  41976. 'È' => 'è',
  41977. 'É' => 'é',
  41978. 'Ê' => 'ê',
  41979. 'Ë' => 'ë',
  41980. 'Ì' => 'ì',
  41981. '�' => 'í',
  41982. 'Î' => 'î',
  41983. '�' => 'ï',
  41984. '�' => 'ð',
  41985. 'Ñ' => 'ñ',
  41986. 'Ò' => 'ò',
  41987. 'Ó' => 'ó',
  41988. 'Ô' => 'ô',
  41989. 'Õ' => 'õ',
  41990. 'Ö' => 'ö',
  41991. 'Ø' => 'ø',
  41992. 'Ù' => 'ù',
  41993. 'Ú' => 'ú',
  41994. 'Û' => 'û',
  41995. 'Ü' => 'ü',
  41996. '�' => 'ý',
  41997. 'Þ' => 'þ',
  41998. 'Ā' => '�',
  41999. 'Ă' => 'ă',
  42000. 'Ä„' => 'Ä…',
  42001. 'Ć' => 'ć',
  42002. 'Ĉ' => 'ĉ',
  42003. 'ÄŠ' => 'Ä‹',
  42004. 'Č' => '�',
  42005. 'Ď' => '�',
  42006. '�' => 'đ',
  42007. 'Ä’' => 'Ä“',
  42008. 'Ä”' => 'Ä•',
  42009. 'Ä–' => 'Ä—',
  42010. 'Ę' => 'ę',
  42011. 'Äš' => 'Ä›',
  42012. 'Ĝ' => '�',
  42013. 'Äž' => 'ÄŸ',
  42014. 'Ä ' => 'Ä¡',
  42015. 'Ä¢' => 'Ä£',
  42016. 'Ĥ' => 'ĥ',
  42017. 'Ħ' => 'ħ',
  42018. 'Ĩ' => 'ĩ',
  42019. 'Ī' => 'ī',
  42020. 'Ĭ' => 'ĭ',
  42021. 'Į' => 'į',
  42022. 'İ' => 'i',
  42023. 'IJ' => 'ij',
  42024. 'Ĵ' => 'ĵ',
  42025. 'Ķ' => 'ķ',
  42026. 'Ĺ' => 'ĺ',
  42027. 'Ļ' => 'ļ',
  42028. 'Ľ' => 'ľ',
  42029. 'Ä¿' => 'Å€',
  42030. '�' => 'ł',
  42031. 'Ń' => 'ń',
  42032. 'Ņ' => 'ņ',
  42033. 'Ň' => 'ň',
  42034. 'ÅŠ' => 'Å‹',
  42035. 'Ō' => '�',
  42036. 'Ŏ' => '�',
  42037. '�' => 'ő',
  42038. 'Å’' => 'Å“',
  42039. 'Å”' => 'Å•',
  42040. 'Å–' => 'Å—',
  42041. 'Ř' => 'ř',
  42042. 'Åš' => 'Å›',
  42043. 'Ŝ' => '�',
  42044. 'Åž' => 'ÅŸ',
  42045. 'Å ' => 'Å¡',
  42046. 'Å¢' => 'Å£',
  42047. 'Ť' => 'ť',
  42048. 'Ŧ' => 'ŧ',
  42049. 'Ũ' => 'ũ',
  42050. 'Ū' => 'ū',
  42051. 'Ŭ' => 'ŭ',
  42052. 'Ů' => 'ů',
  42053. 'Ű' => 'ű',
  42054. 'Ų' => 'ų',
  42055. 'Ŵ' => 'ŵ',
  42056. 'Ŷ' => 'ŷ',
  42057. 'Ÿ' => 'ÿ',
  42058. 'Ź' => 'ź',
  42059. 'Ż' => 'ż',
  42060. 'Ž' => 'ž',
  42061. '�' => 'ɓ',
  42062. 'Ƃ' => 'ƃ',
  42063. 'Æ„' => 'Æ…',
  42064. 'Ɔ' => 'ɔ',
  42065. 'Ƈ' => 'ƈ',
  42066. 'Ɖ' => 'ɖ',
  42067. 'ÆŠ' => 'É—',
  42068. 'Ƌ' => 'ƌ',
  42069. 'Ǝ' => '�',
  42070. '�' => 'ə',
  42071. '�' => 'ɛ',
  42072. 'Æ‘' => 'Æ’',
  42073. 'Æ“' => 'É ',
  42074. 'Æ”' => 'É£',
  42075. 'Æ–' => 'É©',
  42076. 'Ɨ' => 'ɨ',
  42077. 'Ƙ' => 'ƙ',
  42078. 'Ɯ' => 'ɯ',
  42079. '�' => 'ɲ',
  42080. 'Ɵ' => 'ɵ',
  42081. 'Æ ' => 'Æ¡',
  42082. 'Æ¢' => 'Æ£',
  42083. 'Ƥ' => 'ƥ',
  42084. 'Ʀ' => 'ʀ',
  42085. 'Ƨ' => 'ƨ',
  42086. 'Ʃ' => 'ʃ',
  42087. 'Ƭ' => 'ƭ',
  42088. 'Ʈ' => 'ʈ',
  42089. 'Ư' => 'ư',
  42090. 'Ʊ' => 'ʊ',
  42091. 'Ʋ' => 'ʋ',
  42092. 'Ƴ' => 'ƴ',
  42093. 'Ƶ' => 'ƶ',
  42094. 'Æ·' => 'Ê’',
  42095. 'Ƹ' => 'ƹ',
  42096. 'Ƽ' => 'ƽ',
  42097. 'DŽ' => 'dž',
  42098. 'Dž' => 'dž',
  42099. 'LJ' => 'lj',
  42100. 'Lj' => 'lj',
  42101. 'NJ' => 'nj',
  42102. 'Nj' => 'nj',
  42103. '�' => 'ǎ',
  42104. '�' => '�',
  42105. 'Ç‘' => 'Ç’',
  42106. 'Ç“' => 'Ç”',
  42107. 'Ç•' => 'Ç–',
  42108. 'Ǘ' => 'ǘ',
  42109. 'Ç™' => 'Çš',
  42110. 'Ǜ' => 'ǜ',
  42111. 'Çž' => 'ÇŸ',
  42112. 'Ç ' => 'Ç¡',
  42113. 'Ç¢' => 'Ç£',
  42114. 'Ǥ' => 'ǥ',
  42115. 'Ǧ' => 'ǧ',
  42116. 'Ǩ' => 'ǩ',
  42117. 'Ǫ' => 'ǫ',
  42118. 'Ǭ' => 'ǭ',
  42119. 'Ǯ' => 'ǯ',
  42120. 'DZ' => 'dz',
  42121. 'Dz' => 'dz',
  42122. 'Ǵ' => 'ǵ',
  42123. 'Ƕ' => 'ƕ',
  42124. 'Ç·' => 'Æ¿',
  42125. 'Ǹ' => 'ǹ',
  42126. 'Ǻ' => 'ǻ',
  42127. 'Ǽ' => 'ǽ',
  42128. 'Ǿ' => 'ǿ',
  42129. 'Ȁ' => '�',
  42130. 'Ȃ' => 'ȃ',
  42131. 'È„' => 'È…',
  42132. 'Ȇ' => 'ȇ',
  42133. 'Ȉ' => 'ȉ',
  42134. 'ÈŠ' => 'È‹',
  42135. 'Ȍ' => '�',
  42136. 'Ȏ' => '�',
  42137. '�' => 'ȑ',
  42138. 'È’' => 'È“',
  42139. 'È”' => 'È•',
  42140. 'È–' => 'È—',
  42141. 'Ș' => 'ș',
  42142. 'Èš' => 'È›',
  42143. 'Ȝ' => '�',
  42144. 'Èž' => 'ÈŸ',
  42145. 'È ' => 'Æž',
  42146. 'È¢' => 'È£',
  42147. 'Ȥ' => 'ȥ',
  42148. 'Ȧ' => 'ȧ',
  42149. 'Ȩ' => 'ȩ',
  42150. 'Ȫ' => 'ȫ',
  42151. 'Ȭ' => 'ȭ',
  42152. 'Ȯ' => 'ȯ',
  42153. 'Ȱ' => 'ȱ',
  42154. 'Ȳ' => 'ȳ',
  42155. 'Ⱥ' => 'ⱥ',
  42156. 'Ȼ' => 'ȼ',
  42157. 'Ƚ' => 'ƚ',
  42158. 'Ⱦ' => 'ⱦ',
  42159. '�' => 'ɂ',
  42160. 'Ƀ' => 'ƀ',
  42161. 'Ʉ' => 'ʉ',
  42162. 'Ʌ' => 'ʌ',
  42163. 'Ɇ' => 'ɇ',
  42164. 'Ɉ' => 'ɉ',
  42165. 'ÉŠ' => 'É‹',
  42166. 'Ɍ' => '�',
  42167. 'Ɏ' => '�',
  42168. 'Ͱ' => 'ͱ',
  42169. 'Ͳ' => 'ͳ',
  42170. 'Ͷ' => 'ͷ',
  42171. 'Ϳ' => 'ϳ',
  42172. 'Ά' => 'ά',
  42173. 'Έ' => 'έ',
  42174. 'Ή' => 'ή',
  42175. 'Ί' => 'ί',
  42176. 'Ό' => 'ό',
  42177. 'Ύ' => '�',
  42178. '�' => 'ώ',
  42179. 'Α' => 'α',
  42180. 'Β' => 'β',
  42181. 'Γ' => 'γ',
  42182. 'Δ' => 'δ',
  42183. 'Ε' => 'ε',
  42184. 'Ζ' => 'ζ',
  42185. 'Η' => 'η',
  42186. 'Θ' => 'θ',
  42187. 'Ι' => 'ι',
  42188. 'Κ' => 'κ',
  42189. 'Λ' => 'λ',
  42190. 'Μ' => 'μ',
  42191. '�' => 'ν',
  42192. 'Ξ' => 'ξ',
  42193. 'Ο' => 'ο',
  42194. 'Π' => 'π',
  42195. 'Ρ' => '�',
  42196. 'Σ' => 'σ',
  42197. 'Τ' => 'τ',
  42198. 'Î¥' => 'Ï…',
  42199. 'Φ' => 'φ',
  42200. 'Χ' => 'χ',
  42201. 'Ψ' => 'ψ',
  42202. 'Ω' => 'ω',
  42203. 'Ϊ' => 'ϊ',
  42204. 'Ϋ' => 'ϋ',
  42205. '�' => 'ϗ',
  42206. 'Ϙ' => 'ϙ',
  42207. 'Ïš' => 'Ï›',
  42208. 'Ϝ' => '�',
  42209. 'Ïž' => 'ÏŸ',
  42210. 'Ï ' => 'Ï¡',
  42211. 'Ï¢' => 'Ï£',
  42212. 'Ϥ' => 'ϥ',
  42213. 'Ϧ' => 'ϧ',
  42214. 'Ϩ' => 'ϩ',
  42215. 'Ϫ' => 'ϫ',
  42216. 'Ϭ' => 'ϭ',
  42217. 'Ϯ' => 'ϯ',
  42218. 'ϴ' => 'θ',
  42219. 'Ϸ' => 'ϸ',
  42220. 'Ϲ' => 'ϲ',
  42221. 'Ϻ' => 'ϻ',
  42222. 'Ͻ' => 'ͻ',
  42223. 'Ͼ' => 'ͼ',
  42224. 'Ͽ' => 'ͽ',
  42225. 'Ѐ' => '�',
  42226. '�' => 'ё',
  42227. 'Ђ' => 'ђ',
  42228. 'Ѓ' => 'ѓ',
  42229. 'Є' => 'є',
  42230. 'Ð…' => 'Ñ•',
  42231. 'І' => 'і',
  42232. 'Ї' => 'ї',
  42233. 'Ј' => 'ј',
  42234. 'Љ' => 'љ',
  42235. 'Њ' => 'њ',
  42236. 'Ћ' => 'ћ',
  42237. 'Ќ' => 'ќ',
  42238. '�' => '�',
  42239. 'ÐŽ' => 'Ñž',
  42240. '�' => 'џ',
  42241. '�' => 'а',
  42242. 'Б' => 'б',
  42243. 'В' => 'в',
  42244. 'Г' => 'г',
  42245. 'Д' => 'д',
  42246. 'Е' => 'е',
  42247. 'Ж' => 'ж',
  42248. 'З' => 'з',
  42249. 'И' => 'и',
  42250. 'Й' => 'й',
  42251. 'К' => 'к',
  42252. 'Л' => 'л',
  42253. 'М' => 'м',
  42254. '�' => 'н',
  42255. 'О' => 'о',
  42256. 'П' => 'п',
  42257. 'Р' => 'р',
  42258. 'С' => '�',
  42259. 'Т' => 'т',
  42260. 'У' => 'у',
  42261. 'Ф' => 'ф',
  42262. 'Ð¥' => 'Ñ…',
  42263. 'Ц' => 'ц',
  42264. 'Ч' => 'ч',
  42265. 'Ш' => 'ш',
  42266. 'Щ' => 'щ',
  42267. 'Ъ' => 'ъ',
  42268. 'Ы' => 'ы',
  42269. 'Ь' => 'ь',
  42270. 'Э' => '�',
  42271. 'Ю' => 'ю',
  42272. 'Я' => '�',
  42273. 'Ñ ' => 'Ñ¡',
  42274. 'Ñ¢' => 'Ñ£',
  42275. 'Ѥ' => 'ѥ',
  42276. 'Ѧ' => 'ѧ',
  42277. 'Ѩ' => 'ѩ',
  42278. 'Ѫ' => 'ѫ',
  42279. 'Ѭ' => 'ѭ',
  42280. 'Ѯ' => 'ѯ',
  42281. 'Ѱ' => 'ѱ',
  42282. 'Ѳ' => 'ѳ',
  42283. 'Ѵ' => 'ѵ',
  42284. 'Ѷ' => 'ѷ',
  42285. 'Ѹ' => 'ѹ',
  42286. 'Ѻ' => 'ѻ',
  42287. 'Ѽ' => 'ѽ',
  42288. 'Ѿ' => 'ѿ',
  42289. 'Ò€' => 'Ò�',
  42290. 'ÒŠ' => 'Ò‹',
  42291. 'Ҍ' => '�',
  42292. 'ÒŽ' => 'Ò�',
  42293. 'Ò�' => 'Ò‘',
  42294. 'Ò’' => 'Ò“',
  42295. 'Ò”' => 'Ò•',
  42296. 'Ò–' => 'Ò—',
  42297. 'Ò˜' => 'Ò™',
  42298. 'Òš' => 'Ò›',
  42299. 'Ҝ' => '�',
  42300. 'Òž' => 'ÒŸ',
  42301. 'Ò ' => 'Ò¡',
  42302. 'Ò¢' => 'Ò£',
  42303. 'Ò¤' => 'Ò¥',
  42304. 'Ò¦' => 'Ò§',
  42305. 'Ò¨' => 'Ò©',
  42306. 'Òª' => 'Ò«',
  42307. 'Ò¬' => 'Ò­',
  42308. 'Ò®' => 'Ò¯',
  42309. 'Ò°' => 'Ò±',
  42310. 'Ò²' => 'Ò³',
  42311. 'Ò´' => 'Òµ',
  42312. 'Ò¶' => 'Ò·',
  42313. 'Ò¸' => 'Ò¹',
  42314. 'Òº' => 'Ò»',
  42315. 'Ò¼' => 'Ò½',
  42316. 'Ò¾' => 'Ò¿',
  42317. 'Ó€' => 'Ó�',
  42318. 'Ó�' => 'Ó‚',
  42319. 'Óƒ' => 'Ó„',
  42320. 'Ó…' => 'Ó†',
  42321. 'Ó‡' => 'Óˆ',
  42322. 'Ó‰' => 'ÓŠ',
  42323. 'Ӌ' => 'ӌ',
  42324. 'Ó�' => 'ÓŽ',
  42325. 'Ó�' => 'Ó‘',
  42326. 'Ó’' => 'Ó“',
  42327. 'Ó”' => 'Ó•',
  42328. 'Ó–' => 'Ó—',
  42329. 'Ó˜' => 'Ó™',
  42330. 'Óš' => 'Ó›',
  42331. 'Ӝ' => '�',
  42332. 'Óž' => 'ÓŸ',
  42333. 'Ó ' => 'Ó¡',
  42334. 'Ó¢' => 'Ó£',
  42335. 'Ó¤' => 'Ó¥',
  42336. 'Ó¦' => 'Ó§',
  42337. 'Ó¨' => 'Ó©',
  42338. 'Óª' => 'Ó«',
  42339. 'Ó¬' => 'Ó­',
  42340. 'Ó®' => 'Ó¯',
  42341. 'Ó°' => 'Ó±',
  42342. 'Ó²' => 'Ó³',
  42343. 'Ó´' => 'Óµ',
  42344. 'Ó¶' => 'Ó·',
  42345. 'Ó¸' => 'Ó¹',
  42346. 'Óº' => 'Ó»',
  42347. 'Ó¼' => 'Ó½',
  42348. 'Ó¾' => 'Ó¿',
  42349. 'Ô€' => 'Ô�',
  42350. 'Ô‚' => 'Ôƒ',
  42351. 'Ô„' => 'Ô…',
  42352. 'Ô†' => 'Ô‡',
  42353. 'Ôˆ' => 'Ô‰',
  42354. 'ÔŠ' => 'Ô‹',
  42355. 'Ԍ' => '�',
  42356. 'ÔŽ' => 'Ô�',
  42357. 'Ô�' => 'Ô‘',
  42358. 'Ô’' => 'Ô“',
  42359. 'Ô”' => 'Ô•',
  42360. 'Ô–' => 'Ô—',
  42361. 'Ô˜' => 'Ô™',
  42362. 'Ôš' => 'Ô›',
  42363. 'Ԝ' => '�',
  42364. 'Ôž' => 'ÔŸ',
  42365. 'Ô ' => 'Ô¡',
  42366. 'Ô¢' => 'Ô£',
  42367. 'Ô¤' => 'Ô¥',
  42368. 'Ô¦' => 'Ô§',
  42369. 'Ô¨' => 'Ô©',
  42370. 'Ôª' => 'Ô«',
  42371. 'Ô¬' => 'Ô­',
  42372. 'Ô®' => 'Ô¯',
  42373. 'Ô±' => 'Õ¡',
  42374. 'Ô²' => 'Õ¢',
  42375. 'Ô³' => 'Õ£',
  42376. 'Ô´' => 'Õ¤',
  42377. 'Ôµ' => 'Õ¥',
  42378. 'Ô¶' => 'Õ¦',
  42379. 'Ô·' => 'Õ§',
  42380. 'Ô¸' => 'Õ¨',
  42381. 'Ô¹' => 'Õ©',
  42382. 'Ôº' => 'Õª',
  42383. 'Ô»' => 'Õ«',
  42384. 'Ô¼' => 'Õ¬',
  42385. 'Ô½' => 'Õ­',
  42386. 'Ô¾' => 'Õ®',
  42387. 'Ô¿' => 'Õ¯',
  42388. 'Õ€' => 'Õ°',
  42389. 'Õ�' => 'Õ±',
  42390. 'Õ‚' => 'Õ²',
  42391. 'Õƒ' => 'Õ³',
  42392. 'Õ„' => 'Õ´',
  42393. 'Õ…' => 'Õµ',
  42394. 'Õ†' => 'Õ¶',
  42395. 'Õ‡' => 'Õ·',
  42396. 'Õˆ' => 'Õ¸',
  42397. 'Õ‰' => 'Õ¹',
  42398. 'ÕŠ' => 'Õº',
  42399. 'Õ‹' => 'Õ»',
  42400. 'Ռ' => 'ռ',
  42401. 'Õ�' => 'Õ½',
  42402. 'ÕŽ' => 'Õ¾',
  42403. 'Õ�' => 'Õ¿',
  42404. 'Õ�' => 'Ö€',
  42405. 'Õ‘' => 'Ö�',
  42406. 'Õ’' => 'Ö‚',
  42407. 'Õ“' => 'Öƒ',
  42408. 'Õ”' => 'Ö„',
  42409. 'Õ•' => 'Ö…',
  42410. 'Õ–' => 'Ö†',
  42411. 'á‚ ' => 'â´€',
  42412. 'á‚¡' => 'â´�',
  42413. 'á‚¢' => 'â´‚',
  42414. 'á‚£' => 'â´ƒ',
  42415. 'Ⴄ' => 'ⴄ',
  42416. 'á‚¥' => 'â´…',
  42417. 'Ⴆ' => 'ⴆ',
  42418. 'á‚§' => 'â´‡',
  42419. 'Ⴈ' => 'ⴈ',
  42420. 'á‚©' => 'â´‰',
  42421. 'Ⴊ' => 'ⴊ',
  42422. 'á‚«' => 'â´‹',
  42423. 'Ⴌ' => 'ⴌ',
  42424. 'á‚­' => 'â´�',
  42425. 'á‚®' => 'â´Ž',
  42426. 'Ⴏ' => '�',
  42427. 'á‚°' => 'â´�',
  42428. 'Ⴑ' => 'ⴑ',
  42429. 'Ⴒ' => 'ⴒ',
  42430. 'Ⴓ' => 'ⴓ',
  42431. 'á‚´' => 'â´”',
  42432. 'Ⴕ' => 'ⴕ',
  42433. 'á‚¶' => 'â´–',
  42434. 'á‚·' => 'â´—',
  42435. 'Ⴘ' => 'ⴘ',
  42436. 'Ⴙ' => 'ⴙ',
  42437. 'Ⴚ' => 'ⴚ',
  42438. 'á‚»' => 'â´›',
  42439. 'Ⴜ' => 'ⴜ',
  42440. 'Ⴝ' => '�',
  42441. 'Ⴞ' => 'ⴞ',
  42442. 'á‚¿' => 'â´Ÿ',
  42443. 'Ⴠ' => 'ⴠ',
  42444. '�' => 'ⴡ',
  42445. 'Ⴢ' => 'ⴢ',
  42446. 'Ⴣ' => 'ⴣ',
  42447. 'Ⴤ' => 'ⴤ',
  42448. 'Ⴥ' => 'ⴥ',
  42449. 'Ⴧ' => 'ⴧ',
  42450. '�' => 'ⴭ',
  42451. 'Ḁ' => '�',
  42452. 'Ḃ' => 'ḃ',
  42453. 'Ḅ' => 'ḅ',
  42454. 'Ḇ' => 'ḇ',
  42455. 'Ḉ' => 'ḉ',
  42456. 'Ḋ' => 'ḋ',
  42457. 'Ḍ' => '�',
  42458. 'Ḏ' => '�',
  42459. '�' => 'ḑ',
  42460. 'Ḓ' => 'ḓ',
  42461. 'Ḕ' => 'ḕ',
  42462. 'Ḗ' => 'ḗ',
  42463. 'Ḙ' => 'ḙ',
  42464. 'Ḛ' => 'ḛ',
  42465. 'Ḝ' => '�',
  42466. 'Ḟ' => 'ḟ',
  42467. 'Ḡ' => 'ḡ',
  42468. 'Ḣ' => 'ḣ',
  42469. 'Ḥ' => 'ḥ',
  42470. 'Ḧ' => 'ḧ',
  42471. 'Ḩ' => 'ḩ',
  42472. 'Ḫ' => 'ḫ',
  42473. 'Ḭ' => 'ḭ',
  42474. 'Ḯ' => 'ḯ',
  42475. 'Ḱ' => 'ḱ',
  42476. 'Ḳ' => 'ḳ',
  42477. 'Ḵ' => 'ḵ',
  42478. 'Ḷ' => 'ḷ',
  42479. 'Ḹ' => 'ḹ',
  42480. 'Ḻ' => 'ḻ',
  42481. 'Ḽ' => 'ḽ',
  42482. 'Ḿ' => 'ḿ',
  42483. 'Ṁ' => '�',
  42484. 'Ṃ' => 'ṃ',
  42485. 'Ṅ' => 'ṅ',
  42486. 'Ṇ' => 'ṇ',
  42487. 'Ṉ' => 'ṉ',
  42488. 'Ṋ' => 'ṋ',
  42489. 'Ṍ' => '�',
  42490. 'Ṏ' => '�',
  42491. '�' => 'ṑ',
  42492. 'Ṓ' => 'ṓ',
  42493. 'Ṕ' => 'ṕ',
  42494. 'á¹–' => 'á¹—',
  42495. 'Ṙ' => 'ṙ',
  42496. 'Ṛ' => 'ṛ',
  42497. 'Ṝ' => '�',
  42498. 'Ṟ' => 'ṟ',
  42499. 'Ṡ' => 'ṡ',
  42500. 'á¹¢' => 'á¹£',
  42501. 'Ṥ' => 'ṥ',
  42502. 'Ṧ' => 'ṧ',
  42503. 'Ṩ' => 'ṩ',
  42504. 'Ṫ' => 'ṫ',
  42505. 'Ṭ' => 'ṭ',
  42506. 'Ṯ' => 'ṯ',
  42507. 'á¹°' => 'á¹±',
  42508. 'á¹²' => 'á¹³',
  42509. 'á¹´' => 'á¹µ',
  42510. 'á¹¶' => 'á¹·',
  42511. 'Ṹ' => 'ṹ',
  42512. 'Ṻ' => 'ṻ',
  42513. 'á¹¼' => 'á¹½',
  42514. 'Ṿ' => 'ṿ',
  42515. 'Ẁ' => '�',
  42516. 'Ẃ' => 'ẃ',
  42517. 'Ẅ' => 'ẅ',
  42518. 'Ẇ' => 'ẇ',
  42519. 'Ẉ' => 'ẉ',
  42520. 'Ẋ' => 'ẋ',
  42521. 'Ẍ' => '�',
  42522. 'Ẏ' => '�',
  42523. '�' => 'ẑ',
  42524. 'Ẓ' => 'ẓ',
  42525. 'Ẕ' => 'ẕ',
  42526. 'ẞ' => 'ß',
  42527. 'Ạ' => 'ạ',
  42528. 'Ả' => 'ả',
  42529. 'Ấ' => 'ấ',
  42530. 'Ầ' => 'ầ',
  42531. 'Ẩ' => 'ẩ',
  42532. 'Ẫ' => 'ẫ',
  42533. 'Ậ' => 'ậ',
  42534. 'Ắ' => 'ắ',
  42535. 'Ằ' => 'ằ',
  42536. 'Ẳ' => 'ẳ',
  42537. 'Ẵ' => 'ẵ',
  42538. 'Ặ' => 'ặ',
  42539. 'Ẹ' => 'ẹ',
  42540. 'Ẻ' => 'ẻ',
  42541. 'Ẽ' => 'ẽ',
  42542. 'Ế' => 'ế',
  42543. 'Ề' => '�',
  42544. 'Ể' => 'ể',
  42545. 'Ễ' => 'ễ',
  42546. 'Ệ' => 'ệ',
  42547. 'Ỉ' => 'ỉ',
  42548. 'Ị' => 'ị',
  42549. 'Ọ' => '�',
  42550. 'Ỏ' => '�',
  42551. '�' => 'ố',
  42552. 'Ồ' => 'ồ',
  42553. 'Ổ' => 'ổ',
  42554. 'á»–' => 'á»—',
  42555. 'Ộ' => 'ộ',
  42556. 'Ớ' => 'ớ',
  42557. 'Ờ' => '�',
  42558. 'Ở' => 'ở',
  42559. 'Ỡ' => 'ỡ',
  42560. 'Ợ' => 'ợ',
  42561. 'Ụ' => 'ụ',
  42562. 'Ủ' => 'ủ',
  42563. 'Ứ' => 'ứ',
  42564. 'Ừ' => 'ừ',
  42565. 'Ử' => 'ử',
  42566. 'Ữ' => 'ữ',
  42567. 'á»°' => 'á»±',
  42568. 'Ỳ' => 'ỳ',
  42569. 'Ỵ' => 'ỵ',
  42570. 'á»¶' => 'á»·',
  42571. 'Ỹ' => 'ỹ',
  42572. 'Ỻ' => 'ỻ',
  42573. 'Ỽ' => 'ỽ',
  42574. 'Ỿ' => 'ỿ',
  42575. 'Ἀ' => 'ἀ',
  42576. 'Ἁ' => '�',
  42577. 'Ἂ' => 'ἂ',
  42578. 'Ἃ' => 'ἃ',
  42579. 'Ἄ' => 'ἄ',
  42580. '�' => 'ἅ',
  42581. 'Ἆ' => 'ἆ',
  42582. '�' => 'ἇ',
  42583. 'Ἐ' => '�',
  42584. 'Ἑ' => 'ἑ',
  42585. 'Ἒ' => 'ἒ',
  42586. 'Ἓ' => 'ἓ',
  42587. 'Ἔ' => 'ἔ',
  42588. '�' => 'ἕ',
  42589. 'Ἠ' => 'ἠ',
  42590. 'Ἡ' => 'ἡ',
  42591. 'Ἢ' => 'ἢ',
  42592. 'Ἣ' => 'ἣ',
  42593. 'Ἤ' => 'ἤ',
  42594. 'á¼­' => 'á¼¥',
  42595. 'Ἦ' => 'ἦ',
  42596. 'Ἧ' => 'ἧ',
  42597. 'Ἰ' => 'ἰ',
  42598. 'á¼¹' => 'á¼±',
  42599. 'Ἲ' => 'ἲ',
  42600. 'á¼»' => 'á¼³',
  42601. 'á¼¼' => 'á¼´',
  42602. 'á¼½' => 'á¼µ',
  42603. 'á¼¾' => 'á¼¶',
  42604. 'Ἷ' => 'ἷ',
  42605. 'Ὀ' => 'ὀ',
  42606. 'Ὁ' => '�',
  42607. 'Ὂ' => 'ὂ',
  42608. 'Ὃ' => 'ὃ',
  42609. 'Ὄ' => 'ὄ',
  42610. '�' => 'ὅ',
  42611. 'Ὑ' => 'ὑ',
  42612. 'Ὓ' => 'ὓ',
  42613. '�' => 'ὕ',
  42614. 'Ὗ' => 'ὗ',
  42615. 'Ὠ' => 'ὠ',
  42616. 'Ὡ' => 'ὡ',
  42617. 'Ὢ' => 'ὢ',
  42618. 'Ὣ' => 'ὣ',
  42619. 'Ὤ' => 'ὤ',
  42620. 'á½­' => 'á½¥',
  42621. 'Ὦ' => 'ὦ',
  42622. 'Ὧ' => 'ὧ',
  42623. 'ᾈ' => 'ᾀ',
  42624. 'ᾉ' => '�',
  42625. 'ᾊ' => 'ᾂ',
  42626. 'ᾋ' => 'ᾃ',
  42627. 'ᾌ' => 'ᾄ',
  42628. '�' => 'ᾅ',
  42629. 'ᾎ' => 'ᾆ',
  42630. '�' => 'ᾇ',
  42631. 'ᾘ' => '�',
  42632. 'ᾙ' => 'ᾑ',
  42633. 'ᾚ' => 'ᾒ',
  42634. 'ᾛ' => 'ᾓ',
  42635. 'ᾜ' => 'ᾔ',
  42636. '�' => 'ᾕ',
  42637. 'ᾞ' => 'ᾖ',
  42638. 'ᾟ' => 'ᾗ',
  42639. 'ᾨ' => 'ᾠ',
  42640. 'ᾩ' => 'ᾡ',
  42641. 'ᾪ' => 'ᾢ',
  42642. 'ᾫ' => 'ᾣ',
  42643. 'ᾬ' => 'ᾤ',
  42644. 'á¾­' => 'á¾¥',
  42645. 'ᾮ' => 'ᾦ',
  42646. 'ᾯ' => 'ᾧ',
  42647. 'Ᾰ' => 'ᾰ',
  42648. 'á¾¹' => 'á¾±',
  42649. 'Ὰ' => 'ὰ',
  42650. 'á¾»' => 'á½±',
  42651. 'á¾¼' => 'á¾³',
  42652. 'Ὲ' => 'ὲ',
  42653. 'Έ' => 'έ',
  42654. 'Ὴ' => 'ὴ',
  42655. 'á¿‹' => 'á½µ',
  42656. 'ῌ' => 'ῃ',
  42657. 'Ῐ' => '�',
  42658. 'á¿™' => 'á¿‘',
  42659. 'Ὶ' => 'ὶ',
  42660. 'á¿›' => 'á½·',
  42661. 'Ῠ' => 'ῠ',
  42662. 'á¿©' => 'á¿¡',
  42663. 'Ὺ' => 'ὺ',
  42664. 'á¿«' => 'á½»',
  42665. 'Ῥ' => 'ῥ',
  42666. 'Ὸ' => 'ὸ',
  42667. 'Ό' => 'ό',
  42668. 'Ὼ' => 'ὼ',
  42669. 'á¿»' => 'á½½',
  42670. 'ῼ' => 'ῳ',
  42671. 'Ω' => 'ω',
  42672. 'K' => 'k',
  42673. 'â„«' => 'Ã¥',
  42674. 'Ⅎ' => 'ⅎ',
  42675. 'â… ' => 'â…°',
  42676. 'â…¡' => 'â…±',
  42677. 'â…¢' => 'â…²',
  42678. 'â…£' => 'â…³',
  42679. 'â…¤' => 'â…´',
  42680. 'â…¥' => 'â…µ',
  42681. 'â…¦' => 'â…¶',
  42682. 'â…§' => 'â…·',
  42683. 'â…¨' => 'â…¸',
  42684. 'â…©' => 'â…¹',
  42685. 'â…ª' => 'â…º',
  42686. 'â…«' => 'â…»',
  42687. 'â…¬' => 'â…¼',
  42688. 'â…­' => 'â…½',
  42689. 'â…®' => 'â…¾',
  42690. 'â…¯' => 'â…¿',
  42691. 'Ↄ' => 'ↄ',
  42692. 'Ⓐ' => '�',
  42693. 'â’·' => 'â“‘',
  42694. 'â’¸' => 'â“’',
  42695. 'â’¹' => 'â““',
  42696. 'â’º' => 'â“”',
  42697. 'â’»' => 'â“•',
  42698. 'â’¼' => 'â“–',
  42699. 'â’½' => 'â“—',
  42700. 'Ⓘ' => 'ⓘ',
  42701. 'â’¿' => 'â“™',
  42702. 'Ⓚ' => 'ⓚ',
  42703. '�' => 'ⓛ',
  42704. 'Ⓜ' => 'ⓜ',
  42705. 'Ⓝ' => '�',
  42706. 'Ⓞ' => 'ⓞ',
  42707. 'Ⓟ' => 'ⓟ',
  42708. 'Ⓠ' => 'ⓠ',
  42709. 'Ⓡ' => 'ⓡ',
  42710. 'Ⓢ' => 'ⓢ',
  42711. 'Ⓣ' => 'ⓣ',
  42712. 'Ⓤ' => 'ⓤ',
  42713. 'â“‹' => 'â“¥',
  42714. 'Ⓦ' => 'ⓦ',
  42715. '�' => 'ⓧ',
  42716. 'Ⓨ' => 'ⓨ',
  42717. '�' => 'ⓩ',
  42718. 'â°€' => 'â°°',
  42719. 'â°�' => 'â°±',
  42720. 'â°‚' => 'â°²',
  42721. 'â°ƒ' => 'â°³',
  42722. 'â°„' => 'â°´',
  42723. 'â°…' => 'â°µ',
  42724. 'â°†' => 'â°¶',
  42725. 'â°‡' => 'â°·',
  42726. 'â°ˆ' => 'â°¸',
  42727. 'â°‰' => 'â°¹',
  42728. 'â°Š' => 'â°º',
  42729. 'â°‹' => 'â°»',
  42730. 'Ⰼ' => 'ⰼ',
  42731. 'â°�' => 'â°½',
  42732. 'â°Ž' => 'â°¾',
  42733. 'â°�' => 'â°¿',
  42734. 'â°�' => 'â±€',
  42735. 'Ⱁ' => '�',
  42736. 'Ⱂ' => 'ⱂ',
  42737. 'Ⱃ' => 'ⱃ',
  42738. 'Ⱄ' => 'ⱄ',
  42739. 'â°•' => 'â±…',
  42740. 'Ⱆ' => 'ⱆ',
  42741. 'Ⱇ' => 'ⱇ',
  42742. 'Ⱈ' => 'ⱈ',
  42743. 'Ⱉ' => 'ⱉ',
  42744. 'Ⱊ' => 'ⱊ',
  42745. 'Ⱋ' => 'ⱋ',
  42746. 'Ⱌ' => 'ⱌ',
  42747. '�' => '�',
  42748. 'Ⱎ' => 'ⱎ',
  42749. 'Ⱏ' => '�',
  42750. 'Ⱐ' => '�',
  42751. 'Ⱑ' => 'ⱑ',
  42752. 'â°¢' => 'â±’',
  42753. 'Ⱓ' => 'ⱓ',
  42754. 'â°¤' => 'â±”',
  42755. 'Ⱕ' => 'ⱕ',
  42756. 'â°¦' => 'â±–',
  42757. 'â°§' => 'â±—',
  42758. 'Ⱘ' => 'ⱘ',
  42759. 'â°©' => 'â±™',
  42760. 'Ⱚ' => 'ⱚ',
  42761. 'â°«' => 'â±›',
  42762. 'Ⱜ' => 'ⱜ',
  42763. 'Ⱝ' => '�',
  42764. 'Ⱞ' => 'ⱞ',
  42765. 'Ⱡ' => 'ⱡ',
  42766. 'â±¢' => 'É«',
  42767. 'â±£' => 'áµ½',
  42768. 'Ɽ' => 'ɽ',
  42769. 'Ⱨ' => 'ⱨ',
  42770. 'Ⱪ' => 'ⱪ',
  42771. 'Ⱬ' => 'ⱬ',
  42772. 'â±­' => 'É‘',
  42773. 'Ɱ' => 'ɱ',
  42774. 'Ɐ' => '�',
  42775. 'â±°' => 'É’',
  42776. 'â±²' => 'â±³',
  42777. 'â±µ' => 'â±¶',
  42778. 'â±¾' => 'È¿',
  42779. 'Ɀ' => 'ɀ',
  42780. 'Ⲁ' => '�',
  42781. 'Ⲃ' => 'ⲃ',
  42782. 'Ⲅ' => 'ⲅ',
  42783. 'Ⲇ' => 'ⲇ',
  42784. 'Ⲉ' => 'ⲉ',
  42785. 'Ⲋ' => 'ⲋ',
  42786. 'Ⲍ' => '�',
  42787. 'Ⲏ' => '�',
  42788. '�' => 'ⲑ',
  42789. 'Ⲓ' => 'ⲓ',
  42790. 'Ⲕ' => 'ⲕ',
  42791. 'â²–' => 'â²—',
  42792. 'Ⲙ' => 'ⲙ',
  42793. 'Ⲛ' => 'ⲛ',
  42794. 'Ⲝ' => '�',
  42795. 'Ⲟ' => 'ⲟ',
  42796. 'Ⲡ' => 'ⲡ',
  42797. 'â²¢' => 'â²£',
  42798. 'Ⲥ' => 'ⲥ',
  42799. 'Ⲧ' => 'ⲧ',
  42800. 'Ⲩ' => 'ⲩ',
  42801. 'Ⲫ' => 'ⲫ',
  42802. 'Ⲭ' => 'ⲭ',
  42803. 'Ⲯ' => 'ⲯ',
  42804. 'â²°' => 'â²±',
  42805. 'â²²' => 'â²³',
  42806. 'â²´' => 'â²µ',
  42807. 'â²¶' => 'â²·',
  42808. 'Ⲹ' => 'ⲹ',
  42809. 'Ⲻ' => 'ⲻ',
  42810. 'â²¼' => 'â²½',
  42811. 'Ⲿ' => 'ⲿ',
  42812. 'Ⳁ' => '�',
  42813. 'Ⳃ' => 'ⳃ',
  42814. 'Ⳅ' => 'ⳅ',
  42815. 'Ⳇ' => 'ⳇ',
  42816. 'Ⳉ' => 'ⳉ',
  42817. 'Ⳋ' => 'ⳋ',
  42818. 'Ⳍ' => '�',
  42819. 'Ⳏ' => '�',
  42820. '�' => 'ⳑ',
  42821. 'Ⳓ' => 'ⳓ',
  42822. 'Ⳕ' => 'ⳕ',
  42823. 'â³–' => 'â³—',
  42824. 'Ⳙ' => 'ⳙ',
  42825. 'Ⳛ' => 'ⳛ',
  42826. 'Ⳝ' => '�',
  42827. 'Ⳟ' => 'ⳟ',
  42828. 'Ⳡ' => 'ⳡ',
  42829. 'â³¢' => 'â³£',
  42830. 'Ⳬ' => 'ⳬ',
  42831. 'â³­' => 'â³®',
  42832. 'â³²' => 'â³³',
  42833. 'Ꙁ' => '�',
  42834. 'Ꙃ' => 'ꙃ',
  42835. 'Ꙅ' => 'ꙅ',
  42836. 'Ꙇ' => 'ꙇ',
  42837. 'Ꙉ' => 'ꙉ',
  42838. 'Ꙋ' => 'ꙋ',
  42839. 'Ꙍ' => '�',
  42840. 'Ꙏ' => '�',
  42841. '�' => 'ꙑ',
  42842. 'Ꙓ' => 'ꙓ',
  42843. 'Ꙕ' => 'ꙕ',
  42844. 'ê™–' => 'ê™—',
  42845. 'Ꙙ' => 'ꙙ',
  42846. 'Ꙛ' => 'ꙛ',
  42847. 'Ꙝ' => '�',
  42848. 'Ꙟ' => 'ꙟ',
  42849. 'Ꙡ' => 'ꙡ',
  42850. 'Ꙣ' => 'ꙣ',
  42851. 'Ꙥ' => 'ꙥ',
  42852. 'Ꙧ' => 'ꙧ',
  42853. 'Ꙩ' => 'ꙩ',
  42854. 'Ꙫ' => 'ꙫ',
  42855. 'Ꙭ' => 'ꙭ',
  42856. 'Ꚁ' => '�',
  42857. 'Ꚃ' => 'ꚃ',
  42858. 'êš„' => 'êš…',
  42859. 'Ꚇ' => 'ꚇ',
  42860. 'Ꚉ' => 'ꚉ',
  42861. 'Ꚋ' => 'ꚋ',
  42862. 'Ꚍ' => '�',
  42863. 'Ꚏ' => '�',
  42864. '�' => 'ꚑ',
  42865. 'êš’' => 'êš“',
  42866. 'êš”' => 'êš•',
  42867. 'êš–' => 'êš—',
  42868. 'Ꚙ' => 'ꚙ',
  42869. 'êšš' => 'êš›',
  42870. 'Ꜣ' => 'ꜣ',
  42871. 'Ꜥ' => 'ꜥ',
  42872. 'Ꜧ' => 'ꜧ',
  42873. 'Ꜩ' => 'ꜩ',
  42874. 'Ꜫ' => 'ꜫ',
  42875. 'Ꜭ' => 'ꜭ',
  42876. 'Ꜯ' => 'ꜯ',
  42877. 'Ꜳ' => 'ꜳ',
  42878. 'Ꜵ' => 'ꜵ',
  42879. 'Ꜷ' => 'ꜷ',
  42880. 'Ꜹ' => 'ꜹ',
  42881. 'Ꜻ' => 'ꜻ',
  42882. 'Ꜽ' => 'ꜽ',
  42883. 'Ꜿ' => 'ꜿ',
  42884. '�' => '�',
  42885. '�' => '�',
  42886. '�' => '�',
  42887. '�' => '�',
  42888. '�' => '�',
  42889. '�' => '�',
  42890. '�' => '�',
  42891. '�' => '�',
  42892. '�' => '�',
  42893. '�' => '�',
  42894. '�' => '�',
  42895. '�' => '�',
  42896. '�' => '�',
  42897. '�' => '�',
  42898. '�' => '�',
  42899. '�' => '�',
  42900. '�' => '�',
  42901. '�' => '�',
  42902. '�' => '�',
  42903. '�' => '�',
  42904. '�' => '�',
  42905. '�' => '�',
  42906. '�' => '�',
  42907. '�' => '�',
  42908. '�' => '�',
  42909. '�' => '�',
  42910. '�' => 'ᵹ',
  42911. '�' => '�',
  42912. 'Ꞁ' => '�',
  42913. 'Ꞃ' => 'ꞃ',
  42914. 'êž„' => 'êž…',
  42915. 'Ꞇ' => 'ꞇ',
  42916. 'Ꞌ' => 'ꞌ',
  42917. '�' => 'ɥ',
  42918. '�' => 'ꞑ',
  42919. 'êž’' => 'êž“',
  42920. 'êž–' => 'êž—',
  42921. 'Ꞙ' => 'ꞙ',
  42922. 'êžš' => 'êž›',
  42923. 'Ꞝ' => '�',
  42924. 'Ꞟ' => 'ꞟ',
  42925. 'êž ' => 'êž¡',
  42926. 'Ꞣ' => 'ꞣ',
  42927. 'Ꞥ' => 'ꞥ',
  42928. 'Ꞧ' => 'ꞧ',
  42929. 'Ꞩ' => 'ꞩ',
  42930. 'Ɦ' => 'ɦ',
  42931. 'Ɜ' => 'ɜ',
  42932. 'Ɡ' => 'ɡ',
  42933. 'Ɬ' => 'ɬ',
  42934. 'êž°' => 'Êž',
  42935. 'Ʇ' => 'ʇ',
  42936. 'A' => '�',
  42937. 'B' => 'b',
  42938. 'C' => 'c',
  42939. 'D' => 'd',
  42940. 'ï¼¥' => 'ï½…',
  42941. 'F' => 'f',
  42942. 'G' => 'g',
  42943. 'H' => 'h',
  42944. 'I' => 'i',
  42945. 'J' => 'j',
  42946. 'K' => 'k',
  42947. 'L' => 'l',
  42948. 'M' => '�',
  42949. 'N' => 'n',
  42950. 'O' => '�',
  42951. 'P' => '�',
  42952. 'Q' => 'q',
  42953. 'ï¼²' => 'ï½’',
  42954. 'S' => 's',
  42955. 'ï¼´' => 'ï½”',
  42956. 'U' => 'u',
  42957. 'ï¼¶' => 'ï½–',
  42958. 'ï¼·' => 'ï½—',
  42959. 'X' => 'x',
  42960. 'ï¼¹' => 'ï½™',
  42961. 'Z' => 'z',
  42962. '�' => '�',
  42963. '�' => '�',
  42964. '�' => '�',
  42965. '�' => '�',
  42966. '�' => '�',
  42967. '�' => '�',
  42968. '�' => '�',
  42969. '�' => '�',
  42970. '�' => '�',
  42971. '�' => '�',
  42972. '�' => '�',
  42973. '�' => '�',
  42974. '�' => '�',
  42975. '�' => '�',
  42976. '�' => '�',
  42977. '�' => '�',
  42978. '�' => '�',
  42979. '�' => '�',
  42980. '�' => '�',
  42981. '�' => '�',
  42982. '�' => '�',
  42983. '�' => '�',
  42984. '�' => '�',
  42985. '�' => '�',
  42986. '�' => '�',
  42987. '�' => '�',
  42988. '�' => '�',
  42989. '�' => '�',
  42990. '�' => '�',
  42991. '�' => '�',
  42992. '�' => '�',
  42993. '�' => '�',
  42994. '�' => '�',
  42995. '�' => '�',
  42996. '�' => '�',
  42997. '�' => '�',
  42998. '�' => '�',
  42999. '�' => '�',
  43000. '�' => '�',
  43001. '�' => '�',
  43002. 'ð‘¢ ' => 'ð‘£€',
  43003. '𑢡' => '�',
  43004. '𑢢' => '𑣂',
  43005. '𑢣' => '𑣃',
  43006. '𑢤' => '𑣄',
  43007. 'ð‘¢¥' => 'ð‘£…',
  43008. '𑢦' => '𑣆',
  43009. '𑢧' => '𑣇',
  43010. '𑢨' => '𑣈',
  43011. '𑢩' => '𑣉',
  43012. '𑢪' => '𑣊',
  43013. '𑢫' => '𑣋',
  43014. '𑢬' => '𑣌',
  43015. '𑢭' => '�',
  43016. '𑢮' => '𑣎',
  43017. '𑢯' => '�',
  43018. '𑢰' => '�',
  43019. '𑢱' => '𑣑',
  43020. 'ð‘¢²' => 'ð‘£’',
  43021. '𑢳' => '𑣓',
  43022. 'ð‘¢´' => 'ð‘£”',
  43023. '𑢵' => '𑣕',
  43024. 'ð‘¢¶' => 'ð‘£–',
  43025. 'ð‘¢·' => 'ð‘£—',
  43026. '𑢸' => '𑣘',
  43027. 'ð‘¢¹' => 'ð‘£™',
  43028. '𑢺' => '𑣚',
  43029. 'ð‘¢»' => 'ð‘£›',
  43030. '𑢼' => '𑣜',
  43031. '𑢽' => '�',
  43032. '𑢾' => '𑣞',
  43033. '𑢿' => '𑣟',
  43034. );
  43035. $result =& $data;
  43036. unset($data);
  43037. return $result;
  43038. <?php
  43039. static $data = array (
  43040. 'a' => 'A',
  43041. 'b' => 'B',
  43042. 'c' => 'C',
  43043. 'd' => 'D',
  43044. 'e' => 'E',
  43045. 'f' => 'F',
  43046. 'g' => 'G',
  43047. 'h' => 'H',
  43048. 'i' => 'I',
  43049. 'j' => 'J',
  43050. 'k' => 'K',
  43051. 'l' => 'L',
  43052. 'm' => 'M',
  43053. 'n' => 'N',
  43054. 'o' => 'O',
  43055. 'p' => 'P',
  43056. 'q' => 'Q',
  43057. 'r' => 'R',
  43058. 's' => 'S',
  43059. 't' => 'T',
  43060. 'u' => 'U',
  43061. 'v' => 'V',
  43062. 'w' => 'W',
  43063. 'x' => 'X',
  43064. 'y' => 'Y',
  43065. 'z' => 'Z',
  43066. 'µ' => 'Μ',
  43067. 'à' => 'À',
  43068. 'á' => '�',
  43069. 'â' => 'Â',
  43070. 'ã' => 'Ã',
  43071. 'ä' => 'Ä',
  43072. 'Ã¥' => 'Ã…',
  43073. 'æ' => 'Æ',
  43074. 'ç' => 'Ç',
  43075. 'è' => 'È',
  43076. 'é' => 'É',
  43077. 'ê' => 'Ê',
  43078. 'ë' => 'Ë',
  43079. 'ì' => 'Ì',
  43080. 'í' => '�',
  43081. 'î' => 'Î',
  43082. 'ï' => '�',
  43083. 'ð' => '�',
  43084. 'ñ' => 'Ñ',
  43085. 'ò' => 'Ò',
  43086. 'ó' => 'Ó',
  43087. 'ô' => 'Ô',
  43088. 'õ' => 'Õ',
  43089. 'ö' => 'Ö',
  43090. 'ø' => 'Ø',
  43091. 'ù' => 'Ù',
  43092. 'ú' => 'Ú',
  43093. 'û' => 'Û',
  43094. 'ü' => 'Ü',
  43095. 'ý' => '�',
  43096. 'þ' => 'Þ',
  43097. 'ÿ' => 'Ÿ',
  43098. '�' => 'Ā',
  43099. 'ă' => 'Ă',
  43100. 'Ä…' => 'Ä„',
  43101. 'ć' => 'Ć',
  43102. 'ĉ' => 'Ĉ',
  43103. 'Ä‹' => 'ÄŠ',
  43104. '�' => 'Č',
  43105. '�' => 'Ď',
  43106. 'đ' => '�',
  43107. 'Ä“' => 'Ä’',
  43108. 'Ä•' => 'Ä”',
  43109. 'Ä—' => 'Ä–',
  43110. 'ę' => 'Ę',
  43111. 'Ä›' => 'Äš',
  43112. '�' => 'Ĝ',
  43113. 'ÄŸ' => 'Äž',
  43114. 'Ä¡' => 'Ä ',
  43115. 'Ä£' => 'Ä¢',
  43116. 'ĥ' => 'Ĥ',
  43117. 'ħ' => 'Ħ',
  43118. 'ĩ' => 'Ĩ',
  43119. 'ī' => 'Ī',
  43120. 'ĭ' => 'Ĭ',
  43121. 'į' => 'Į',
  43122. 'ı' => 'I',
  43123. 'ij' => 'IJ',
  43124. 'ĵ' => 'Ĵ',
  43125. 'ķ' => 'Ķ',
  43126. 'ĺ' => 'Ĺ',
  43127. 'ļ' => 'Ļ',
  43128. 'ľ' => 'Ľ',
  43129. 'Å€' => 'Ä¿',
  43130. 'ł' => '�',
  43131. 'ń' => 'Ń',
  43132. 'ņ' => 'Ņ',
  43133. 'ň' => 'Ň',
  43134. 'Å‹' => 'ÅŠ',
  43135. '�' => 'Ō',
  43136. '�' => 'Ŏ',
  43137. 'ő' => '�',
  43138. 'Å“' => 'Å’',
  43139. 'Å•' => 'Å”',
  43140. 'Å—' => 'Å–',
  43141. 'ř' => 'Ř',
  43142. 'Å›' => 'Åš',
  43143. '�' => 'Ŝ',
  43144. 'ÅŸ' => 'Åž',
  43145. 'Å¡' => 'Å ',
  43146. 'Å£' => 'Å¢',
  43147. 'ť' => 'Ť',
  43148. 'ŧ' => 'Ŧ',
  43149. 'ũ' => 'Ũ',
  43150. 'ū' => 'Ū',
  43151. 'ŭ' => 'Ŭ',
  43152. 'ů' => 'Ů',
  43153. 'ű' => 'Ű',
  43154. 'ų' => 'Ų',
  43155. 'ŵ' => 'Ŵ',
  43156. 'ŷ' => 'Ŷ',
  43157. 'ź' => 'Ź',
  43158. 'ż' => 'Ż',
  43159. 'ž' => 'Ž',
  43160. 'Å¿' => 'S',
  43161. 'ƀ' => 'Ƀ',
  43162. 'ƃ' => 'Ƃ',
  43163. 'Æ…' => 'Æ„',
  43164. 'ƈ' => 'Ƈ',
  43165. 'ƌ' => 'Ƌ',
  43166. 'Æ’' => 'Æ‘',
  43167. 'ƕ' => 'Ƕ',
  43168. 'ƙ' => 'Ƙ',
  43169. 'ƚ' => 'Ƚ',
  43170. 'Æž' => 'È ',
  43171. 'Æ¡' => 'Æ ',
  43172. 'Æ£' => 'Æ¢',
  43173. 'ƥ' => 'Ƥ',
  43174. 'ƨ' => 'Ƨ',
  43175. 'ƭ' => 'Ƭ',
  43176. 'ư' => 'Ư',
  43177. 'ƴ' => 'Ƴ',
  43178. 'ƶ' => 'Ƶ',
  43179. 'ƹ' => 'Ƹ',
  43180. 'ƽ' => 'Ƽ',
  43181. 'Æ¿' => 'Ç·',
  43182. 'Ç…' => 'Ç„',
  43183. 'dž' => 'DŽ',
  43184. 'Lj' => 'LJ',
  43185. 'lj' => 'LJ',
  43186. 'Ç‹' => 'ÇŠ',
  43187. 'nj' => 'NJ',
  43188. 'ǎ' => '�',
  43189. '�' => '�',
  43190. 'Ç’' => 'Ç‘',
  43191. 'Ç”' => 'Ç“',
  43192. 'Ç–' => 'Ç•',
  43193. 'ǘ' => 'Ǘ',
  43194. 'Çš' => 'Ç™',
  43195. 'ǜ' => 'Ǜ',
  43196. '�' => 'Ǝ',
  43197. 'ÇŸ' => 'Çž',
  43198. 'Ç¡' => 'Ç ',
  43199. 'Ç£' => 'Ç¢',
  43200. 'ǥ' => 'Ǥ',
  43201. 'ǧ' => 'Ǧ',
  43202. 'ǩ' => 'Ǩ',
  43203. 'ǫ' => 'Ǫ',
  43204. 'ǭ' => 'Ǭ',
  43205. 'ǯ' => 'Ǯ',
  43206. 'Dz' => 'DZ',
  43207. 'dz' => 'DZ',
  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. 'ͅ' => 'Ι',
  43282. 'ͱ' => 'Ͱ',
  43283. 'ͳ' => 'Ͳ',
  43284. 'ͷ' => 'Ͷ',
  43285. 'ͻ' => 'Ͻ',
  43286. 'ͼ' => 'Ͼ',
  43287. 'ͽ' => 'Ͽ',
  43288. 'ά' => 'Ά',
  43289. 'έ' => 'Έ',
  43290. 'ή' => 'Ή',
  43291. 'ί' => 'Ί',
  43292. 'α' => 'Α',
  43293. 'β' => 'Β',
  43294. 'γ' => 'Γ',
  43295. 'δ' => 'Δ',
  43296. 'ε' => 'Ε',
  43297. 'ζ' => 'Ζ',
  43298. 'η' => 'Η',
  43299. 'θ' => 'Θ',
  43300. 'ι' => 'Ι',
  43301. 'κ' => 'Κ',
  43302. 'λ' => 'Λ',
  43303. 'μ' => 'Μ',
  43304. 'ν' => '�',
  43305. 'ξ' => 'Ξ',
  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. 'ⲅ' => 'Ⲅ',
  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. '�' => 'A',
  44043. 'b' => 'B',
  44044. 'c' => 'C',
  44045. 'd' => 'D',
  44046. 'ï½…' => 'ï¼¥',
  44047. 'f' => 'F',
  44048. 'g' => 'G',
  44049. 'h' => 'H',
  44050. 'i' => 'I',
  44051. 'j' => 'J',
  44052. 'k' => 'K',
  44053. 'l' => 'L',
  44054. '�' => 'M',
  44055. 'n' => 'N',
  44056. '�' => 'O',
  44057. '�' => 'P',
  44058. 'q' => 'Q',
  44059. 'ï½’' => 'ï¼²',
  44060. 's' => 'S',
  44061. 'ï½”' => 'ï¼´',
  44062. 'u' => 'U',
  44063. 'ï½–' => 'ï¼¶',
  44064. 'ï½—' => 'ï¼·',
  44065. 'x' => 'X',
  44066. 'ï½™' => 'ï¼¹',
  44067. 'z' => 'Z',
  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. '𑣌' => '𑢬',
  44121. '�' => '𑢭',
  44122. '𑣎' => '𑢮',
  44123. '�' => '𑢯',
  44124. '�' => '𑢰',
  44125. '𑣑' => '𑢱',
  44126. 'ð‘£’' => 'ð‘¢²',
  44127. '𑣓' => '𑢳',
  44128. 'ð‘£”' => 'ð‘¢´',
  44129. '𑣕' => '𑢵',
  44130. 'ð‘£–' => 'ð‘¢¶',
  44131. 'ð‘£—' => 'ð‘¢·',
  44132. '𑣘' => '𑢸',
  44133. 'ð‘£™' => 'ð‘¢¹',
  44134. '𑣚' => '𑢺',
  44135. 'ð‘£›' => 'ð‘¢»',
  44136. '𑣜' => '𑢼',
  44137. '�' => '𑢽',
  44138. '𑣞' => '𑢾',
  44139. '𑣟' => '𑢿',
  44140. );
  44141. $result =& $data;
  44142. unset($data);
  44143. return $result;
  44144. <?php
  44145. use Symfony\Polyfill\Mbstring as p;
  44146. if (!function_exists('mb_strlen')) {
  44147. define('MB_CASE_UPPER', 0);
  44148. define('MB_CASE_LOWER', 1);
  44149. define('MB_CASE_TITLE', 2);
  44150. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  44151. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  44152. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  44153. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  44154. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  44155. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  44156. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  44157. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  44158. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  44159. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  44160. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  44161. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  44162. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  44163. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  44164. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  44165. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  44166. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  44167. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  44168. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  44169. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  44170. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  44171. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  44172. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  44173. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  44174. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  44175. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  44176. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  44177. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  44178. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  44179. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  44180. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  44181. 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); }
  44182. }
  44183. if (!function_exists('mb_chr')) {
  44184. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  44185. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  44186. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  44187. }
  44188. <?php
  44189. namespace Symfony\Component\Process\Exception;
  44190. interface ExceptionInterface
  44191. {
  44192. }
  44193. <?php
  44194. namespace Symfony\Component\Process\Exception;
  44195. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  44196. {
  44197. }
  44198. <?php
  44199. namespace Symfony\Component\Process\Exception;
  44200. class LogicException extends \LogicException implements ExceptionInterface
  44201. {
  44202. }
  44203. <?php
  44204. namespace Symfony\Component\Process\Exception;
  44205. use Symfony\Component\Process\Process;
  44206. class ProcessFailedException extends RuntimeException
  44207. {
  44208. private $process;
  44209. public function __construct(Process $process)
  44210. {
  44211. if ($process->isSuccessful()) {
  44212. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  44213. }
  44214. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  44215. $process->getCommandLine(),
  44216. $process->getExitCode(),
  44217. $process->getExitCodeText(),
  44218. $process->getWorkingDirectory()
  44219. );
  44220. if (!$process->isOutputDisabled()) {
  44221. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  44222. $process->getOutput(),
  44223. $process->getErrorOutput()
  44224. );
  44225. }
  44226. parent::__construct($error);
  44227. $this->process = $process;
  44228. }
  44229. public function getProcess()
  44230. {
  44231. return $this->process;
  44232. }
  44233. }
  44234. <?php
  44235. namespace Symfony\Component\Process\Exception;
  44236. use Symfony\Component\Process\Process;
  44237. class ProcessTimedOutException extends RuntimeException
  44238. {
  44239. const TYPE_GENERAL = 1;
  44240. const TYPE_IDLE = 2;
  44241. private $process;
  44242. private $timeoutType;
  44243. public function __construct(Process $process, $timeoutType)
  44244. {
  44245. $this->process = $process;
  44246. $this->timeoutType = $timeoutType;
  44247. parent::__construct(sprintf(
  44248. 'The process "%s" exceeded the timeout of %s seconds.',
  44249. $process->getCommandLine(),
  44250. $this->getExceededTimeout()
  44251. ));
  44252. }
  44253. public function getProcess()
  44254. {
  44255. return $this->process;
  44256. }
  44257. public function isGeneralTimeout()
  44258. {
  44259. return self::TYPE_GENERAL === $this->timeoutType;
  44260. }
  44261. public function isIdleTimeout()
  44262. {
  44263. return self::TYPE_IDLE === $this->timeoutType;
  44264. }
  44265. public function getExceededTimeout()
  44266. {
  44267. switch ($this->timeoutType) {
  44268. case self::TYPE_GENERAL:
  44269. return $this->process->getTimeout();
  44270. case self::TYPE_IDLE:
  44271. return $this->process->getIdleTimeout();
  44272. default:
  44273. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  44274. }
  44275. }
  44276. }
  44277. <?php
  44278. namespace Symfony\Component\Process\Exception;
  44279. class RuntimeException extends \RuntimeException implements ExceptionInterface
  44280. {
  44281. }
  44282. <?php
  44283. namespace Symfony\Component\Process;
  44284. class ExecutableFinder
  44285. {
  44286. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  44287. public function setSuffixes(array $suffixes)
  44288. {
  44289. $this->suffixes = $suffixes;
  44290. }
  44291. public function addSuffix($suffix)
  44292. {
  44293. $this->suffixes[] = $suffix;
  44294. }
  44295. public function find($name, $default = null, array $extraDirs = array())
  44296. {
  44297. if (ini_get('open_basedir')) {
  44298. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  44299. $dirs = array();
  44300. foreach ($searchPath as $path) {
  44301. if (@is_dir($path)) {
  44302. $dirs[] = $path;
  44303. } else {
  44304. if (basename($path) == $name && @is_executable($path)) {
  44305. return $path;
  44306. }
  44307. }
  44308. }
  44309. } else {
  44310. $dirs = array_merge(
  44311. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  44312. $extraDirs
  44313. );
  44314. }
  44315. $suffixes = array('');
  44316. if ('\\' === DIRECTORY_SEPARATOR) {
  44317. $pathExt = getenv('PATHEXT');
  44318. $suffixes = array_merge($suffixes, $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes);
  44319. }
  44320. foreach ($suffixes as $suffix) {
  44321. foreach ($dirs as $dir) {
  44322. if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
  44323. return $file;
  44324. }
  44325. }
  44326. }
  44327. return $default;
  44328. }
  44329. }
  44330. Copyright (c) 2004-2017 Fabien Potencier
  44331. Permission is hereby granted, free of charge, to any person obtaining a copy
  44332. of this software and associated documentation files (the "Software"), to deal
  44333. in the Software without restriction, including without limitation the rights
  44334. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44335. copies of the Software, and to permit persons to whom the Software is furnished
  44336. to do so, subject to the following conditions:
  44337. The above copyright notice and this permission notice shall be included in all
  44338. copies or substantial portions of the Software.
  44339. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44340. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44341. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44342. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44343. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44344. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44345. THE SOFTWARE.
  44346. <?php
  44347. namespace Symfony\Component\Process;
  44348. class PhpExecutableFinder
  44349. {
  44350. private $executableFinder;
  44351. public function __construct()
  44352. {
  44353. $this->executableFinder = new ExecutableFinder();
  44354. }
  44355. public function find($includeArgs = true)
  44356. {
  44357. $args = $this->findArguments();
  44358. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  44359. if (defined('HHVM_VERSION')) {
  44360. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  44361. }
  44362. if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) && is_file(PHP_BINARY)) {
  44363. return PHP_BINARY.$args;
  44364. }
  44365. if ($php = getenv('PHP_PATH')) {
  44366. if (!is_executable($php)) {
  44367. return false;
  44368. }
  44369. return $php;
  44370. }
  44371. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  44372. if (is_executable($php)) {
  44373. return $php;
  44374. }
  44375. }
  44376. $dirs = array(PHP_BINDIR);
  44377. if ('\\' === DIRECTORY_SEPARATOR) {
  44378. $dirs[] = 'C:\xampp\php\\';
  44379. }
  44380. return $this->executableFinder->find('php', false, $dirs);
  44381. }
  44382. public function findArguments()
  44383. {
  44384. $arguments = array();
  44385. if (defined('HHVM_VERSION')) {
  44386. $arguments[] = '--php';
  44387. } elseif ('phpdbg' === PHP_SAPI) {
  44388. $arguments[] = '-qrr';
  44389. }
  44390. return $arguments;
  44391. }
  44392. }
  44393. <?php
  44394. namespace Symfony\Component\Process;
  44395. use Symfony\Component\Process\Exception\RuntimeException;
  44396. class PhpProcess extends Process
  44397. {
  44398. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  44399. {
  44400. $executableFinder = new PhpExecutableFinder();
  44401. if (false === $php = $executableFinder->find()) {
  44402. $php = null;
  44403. }
  44404. if ('phpdbg' === PHP_SAPI) {
  44405. $file = tempnam(sys_get_temp_dir(), 'dbg');
  44406. file_put_contents($file, $script);
  44407. register_shutdown_function('unlink', $file);
  44408. $php .= ' '.ProcessUtils::escapeArgument($file);
  44409. $script = null;
  44410. }
  44411. if ('\\' !== DIRECTORY_SEPARATOR && null !== $php) {
  44412. $php = 'exec '.$php;
  44413. }
  44414. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  44415. }
  44416. public function setPhpBinary($php)
  44417. {
  44418. $this->setCommandLine($php);
  44419. }
  44420. public function start($callback = null)
  44421. {
  44422. if (null === $this->getCommandLine()) {
  44423. throw new RuntimeException('Unable to find the PHP executable.');
  44424. }
  44425. parent::start($callback);
  44426. }
  44427. }
  44428. <?php
  44429. namespace Symfony\Component\Process\Pipes;
  44430. abstract class AbstractPipes implements PipesInterface
  44431. {
  44432. public $pipes = array();
  44433. private $inputBuffer = '';
  44434. private $input;
  44435. private $blocked = true;
  44436. public function __construct($input)
  44437. {
  44438. if (is_resource($input)) {
  44439. $this->input = $input;
  44440. } elseif (is_string($input)) {
  44441. $this->inputBuffer = $input;
  44442. } else {
  44443. $this->inputBuffer = (string) $input;
  44444. }
  44445. }
  44446. public function close()
  44447. {
  44448. foreach ($this->pipes as $pipe) {
  44449. fclose($pipe);
  44450. }
  44451. $this->pipes = array();
  44452. }
  44453. protected function hasSystemCallBeenInterrupted()
  44454. {
  44455. $lastError = error_get_last();
  44456. return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
  44457. }
  44458. protected function unblock()
  44459. {
  44460. if (!$this->blocked) {
  44461. return;
  44462. }
  44463. foreach ($this->pipes as $pipe) {
  44464. stream_set_blocking($pipe, 0);
  44465. }
  44466. if (null !== $this->input) {
  44467. stream_set_blocking($this->input, 0);
  44468. }
  44469. $this->blocked = false;
  44470. }
  44471. protected function write()
  44472. {
  44473. if (!isset($this->pipes[0])) {
  44474. return;
  44475. }
  44476. $input = $this->input;
  44477. $r = $e = array();
  44478. $w = array($this->pipes[0]);
  44479. if (false === $n = @stream_select($r, $w, $e, 0, 0)) {
  44480. return;
  44481. }
  44482. foreach ($w as $stdin) {
  44483. if (isset($this->inputBuffer[0])) {
  44484. $written = fwrite($stdin, $this->inputBuffer);
  44485. $this->inputBuffer = substr($this->inputBuffer, $written);
  44486. if (isset($this->inputBuffer[0])) {
  44487. return array($this->pipes[0]);
  44488. }
  44489. }
  44490. if ($input) {
  44491. for (;;) {
  44492. $data = fread($input, self::CHUNK_SIZE);
  44493. if (!isset($data[0])) {
  44494. break;
  44495. }
  44496. $written = fwrite($stdin, $data);
  44497. $data = substr($data, $written);
  44498. if (isset($data[0])) {
  44499. $this->inputBuffer = $data;
  44500. return array($this->pipes[0]);
  44501. }
  44502. }
  44503. if (feof($input)) {
  44504. $this->input = null;
  44505. }
  44506. }
  44507. }
  44508. if (null === $this->input && !isset($this->inputBuffer[0])) {
  44509. fclose($this->pipes[0]);
  44510. unset($this->pipes[0]);
  44511. } elseif (!$w) {
  44512. return array($this->pipes[0]);
  44513. }
  44514. }
  44515. }
  44516. <?php
  44517. namespace Symfony\Component\Process\Pipes;
  44518. interface PipesInterface
  44519. {
  44520. const CHUNK_SIZE = 16384;
  44521. public function getDescriptors();
  44522. public function getFiles();
  44523. public function readAndWrite($blocking, $close = false);
  44524. public function areOpen();
  44525. public function close();
  44526. }
  44527. <?php
  44528. namespace Symfony\Component\Process\Pipes;
  44529. use Symfony\Component\Process\Process;
  44530. class UnixPipes extends AbstractPipes
  44531. {
  44532. private $ttyMode;
  44533. private $ptyMode;
  44534. private $disableOutput;
  44535. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  44536. {
  44537. $this->ttyMode = (bool) $ttyMode;
  44538. $this->ptyMode = (bool) $ptyMode;
  44539. $this->disableOutput = (bool) $disableOutput;
  44540. parent::__construct($input);
  44541. }
  44542. public function __destruct()
  44543. {
  44544. $this->close();
  44545. }
  44546. public function getDescriptors()
  44547. {
  44548. if ($this->disableOutput) {
  44549. $nullstream = fopen('/dev/null', 'c');
  44550. return array(
  44551. array('pipe', 'r'),
  44552. $nullstream,
  44553. $nullstream,
  44554. );
  44555. }
  44556. if ($this->ttyMode) {
  44557. return array(
  44558. array('file', '/dev/tty', 'r'),
  44559. array('file', '/dev/tty', 'w'),
  44560. array('file', '/dev/tty', 'w'),
  44561. );
  44562. }
  44563. if ($this->ptyMode && Process::isPtySupported()) {
  44564. return array(
  44565. array('pty'),
  44566. array('pty'),
  44567. array('pty'),
  44568. );
  44569. }
  44570. return array(
  44571. array('pipe', 'r'),
  44572. array('pipe', 'w'),
  44573. array('pipe', 'w'),
  44574. );
  44575. }
  44576. public function getFiles()
  44577. {
  44578. return array();
  44579. }
  44580. public function readAndWrite($blocking, $close = false)
  44581. {
  44582. $this->unblock();
  44583. $w = $this->write();
  44584. $read = $e = array();
  44585. $r = $this->pipes;
  44586. unset($r[0]);
  44587. if (($r || $w) && false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  44588. if (!$this->hasSystemCallBeenInterrupted()) {
  44589. $this->pipes = array();
  44590. }
  44591. return $read;
  44592. }
  44593. foreach ($r as $pipe) {
  44594. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  44595. do {
  44596. $data = fread($pipe, self::CHUNK_SIZE);
  44597. $read[$type] .= $data;
  44598. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  44599. if (!isset($read[$type][0])) {
  44600. unset($read[$type]);
  44601. }
  44602. if ($close && feof($pipe)) {
  44603. fclose($pipe);
  44604. unset($this->pipes[$type]);
  44605. }
  44606. }
  44607. return $read;
  44608. }
  44609. public function areOpen()
  44610. {
  44611. return (bool) $this->pipes;
  44612. }
  44613. public static function create(Process $process, $input)
  44614. {
  44615. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  44616. }
  44617. }
  44618. <?php
  44619. namespace Symfony\Component\Process\Pipes;
  44620. use Symfony\Component\Process\Process;
  44621. use Symfony\Component\Process\Exception\RuntimeException;
  44622. class WindowsPipes extends AbstractPipes
  44623. {
  44624. private $files = array();
  44625. private $fileHandles = array();
  44626. private $readBytes = array(
  44627. Process::STDOUT => 0,
  44628. Process::STDERR => 0,
  44629. );
  44630. private $disableOutput;
  44631. public function __construct($disableOutput, $input)
  44632. {
  44633. $this->disableOutput = (bool) $disableOutput;
  44634. if (!$this->disableOutput) {
  44635. $pipes = array(
  44636. Process::STDOUT => Process::OUT,
  44637. Process::STDERR => Process::ERR,
  44638. );
  44639. $tmpCheck = false;
  44640. $tmpDir = sys_get_temp_dir();
  44641. $lastError = 'unknown reason';
  44642. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  44643. for ($i = 0;; ++$i) {
  44644. foreach ($pipes as $pipe => $name) {
  44645. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  44646. if (file_exists($file) && !unlink($file)) {
  44647. continue 2;
  44648. }
  44649. $h = fopen($file, 'xb');
  44650. if (!$h) {
  44651. $error = $lastError;
  44652. if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) {
  44653. continue;
  44654. }
  44655. restore_error_handler();
  44656. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
  44657. }
  44658. if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) {
  44659. continue 2;
  44660. }
  44661. if (isset($this->files[$pipe])) {
  44662. unlink($this->files[$pipe]);
  44663. }
  44664. $this->files[$pipe] = $file;
  44665. }
  44666. break;
  44667. }
  44668. restore_error_handler();
  44669. }
  44670. parent::__construct($input);
  44671. }
  44672. public function __destruct()
  44673. {
  44674. $this->close();
  44675. $this->removeFiles();
  44676. }
  44677. public function getDescriptors()
  44678. {
  44679. if ($this->disableOutput) {
  44680. $nullstream = fopen('NUL', 'c');
  44681. return array(
  44682. array('pipe', 'r'),
  44683. $nullstream,
  44684. $nullstream,
  44685. );
  44686. }
  44687. return array(
  44688. array('pipe', 'r'),
  44689. array('file', 'NUL', 'w'),
  44690. array('file', 'NUL', 'w'),
  44691. );
  44692. }
  44693. public function getFiles()
  44694. {
  44695. return $this->files;
  44696. }
  44697. public function readAndWrite($blocking, $close = false)
  44698. {
  44699. $this->unblock();
  44700. $w = $this->write();
  44701. $read = $r = $e = array();
  44702. if ($blocking) {
  44703. if ($w) {
  44704. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  44705. } elseif ($this->fileHandles) {
  44706. usleep(Process::TIMEOUT_PRECISION * 1E6);
  44707. }
  44708. }
  44709. foreach ($this->fileHandles as $type => $fileHandle) {
  44710. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  44711. if (isset($data[0])) {
  44712. $this->readBytes[$type] += strlen($data);
  44713. $read[$type] = $data;
  44714. }
  44715. if ($close) {
  44716. fclose($fileHandle);
  44717. unset($this->fileHandles[$type]);
  44718. }
  44719. }
  44720. return $read;
  44721. }
  44722. public function areOpen()
  44723. {
  44724. return $this->pipes && $this->fileHandles;
  44725. }
  44726. public function close()
  44727. {
  44728. parent::close();
  44729. foreach ($this->fileHandles as $handle) {
  44730. fclose($handle);
  44731. }
  44732. $this->fileHandles = array();
  44733. }
  44734. public static function create(Process $process, $input)
  44735. {
  44736. return new static($process->isOutputDisabled(), $input);
  44737. }
  44738. private function removeFiles()
  44739. {
  44740. foreach ($this->files as $filename) {
  44741. if (file_exists($filename)) {
  44742. @unlink($filename);
  44743. }
  44744. }
  44745. $this->files = array();
  44746. }
  44747. }
  44748. <?php
  44749. namespace Symfony\Component\Process;
  44750. use Symfony\Component\Process\Exception\InvalidArgumentException;
  44751. use Symfony\Component\Process\Exception\LogicException;
  44752. use Symfony\Component\Process\Exception\ProcessFailedException;
  44753. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  44754. use Symfony\Component\Process\Exception\RuntimeException;
  44755. use Symfony\Component\Process\Pipes\PipesInterface;
  44756. use Symfony\Component\Process\Pipes\UnixPipes;
  44757. use Symfony\Component\Process\Pipes\WindowsPipes;
  44758. class Process
  44759. {
  44760. const ERR = 'err';
  44761. const OUT = 'out';
  44762. const STATUS_READY = 'ready';
  44763. const STATUS_STARTED = 'started';
  44764. const STATUS_TERMINATED = 'terminated';
  44765. const STDIN = 0;
  44766. const STDOUT = 1;
  44767. const STDERR = 2;
  44768. const TIMEOUT_PRECISION = 0.2;
  44769. private $callback;
  44770. private $commandline;
  44771. private $cwd;
  44772. private $env;
  44773. private $input;
  44774. private $starttime;
  44775. private $lastOutputTime;
  44776. private $timeout;
  44777. private $idleTimeout;
  44778. private $options;
  44779. private $exitcode;
  44780. private $fallbackStatus = array();
  44781. private $processInformation;
  44782. private $outputDisabled = false;
  44783. private $stdout;
  44784. private $stderr;
  44785. private $enhanceWindowsCompatibility = true;
  44786. private $enhanceSigchildCompatibility;
  44787. private $process;
  44788. private $status = self::STATUS_READY;
  44789. private $incrementalOutputOffset = 0;
  44790. private $incrementalErrorOutputOffset = 0;
  44791. private $tty;
  44792. private $pty;
  44793. private $useFileHandles = false;
  44794. private $processPipes;
  44795. private $latestSignal;
  44796. private static $sigchild;
  44797. public static $exitCodes = array(
  44798. 0 => 'OK',
  44799. 1 => 'General error',
  44800. 2 => 'Misuse of shell builtins',
  44801. 126 => 'Invoked command cannot execute',
  44802. 127 => 'Command not found',
  44803. 128 => 'Invalid exit argument',
  44804. 129 => 'Hangup',
  44805. 130 => 'Interrupt',
  44806. 131 => 'Quit and dump core',
  44807. 132 => 'Illegal instruction',
  44808. 133 => 'Trace/breakpoint trap',
  44809. 134 => 'Process aborted',
  44810. 135 => 'Bus error: "access to undefined portion of memory object"',
  44811. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  44812. 137 => 'Kill (terminate immediately)',
  44813. 138 => 'User-defined 1',
  44814. 139 => 'Segmentation violation',
  44815. 140 => 'User-defined 2',
  44816. 141 => 'Write to pipe with no one reading',
  44817. 142 => 'Signal raised by alarm',
  44818. 143 => 'Termination (request to terminate)',
  44819. 145 => 'Child process terminated, stopped (or continued*)',
  44820. 146 => 'Continue if stopped',
  44821. 147 => 'Stop executing temporarily',
  44822. 148 => 'Terminal stop signal',
  44823. 149 => 'Background process attempting to read from tty ("in")',
  44824. 150 => 'Background process attempting to write to tty ("out")',
  44825. 151 => 'Urgent data available on socket',
  44826. 152 => 'CPU time limit exceeded',
  44827. 153 => 'File size limit exceeded',
  44828. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  44829. 155 => 'Profiling timer expired',
  44830. 157 => 'Pollable event',
  44831. 159 => 'Bad syscall',
  44832. );
  44833. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  44834. {
  44835. if (!function_exists('proc_open')) {
  44836. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  44837. }
  44838. $this->commandline = $commandline;
  44839. $this->cwd = $cwd;
  44840. if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
  44841. $this->cwd = getcwd();
  44842. }
  44843. if (null !== $env) {
  44844. $this->setEnv($env);
  44845. }
  44846. $this->setInput($input);
  44847. $this->setTimeout($timeout);
  44848. $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
  44849. $this->pty = false;
  44850. $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  44851. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  44852. }
  44853. public function __destruct()
  44854. {
  44855. $this->stop(0);
  44856. }
  44857. public function __clone()
  44858. {
  44859. $this->resetProcessData();
  44860. }
  44861. public function run($callback = null)
  44862. {
  44863. $this->start($callback);
  44864. return $this->wait();
  44865. }
  44866. public function mustRun($callback = null)
  44867. {
  44868. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  44869. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  44870. }
  44871. if (0 !== $this->run($callback)) {
  44872. throw new ProcessFailedException($this);
  44873. }
  44874. return $this;
  44875. }
  44876. public function start($callback = null)
  44877. {
  44878. if ($this->isRunning()) {
  44879. throw new RuntimeException('Process is already running');
  44880. }
  44881. if ($this->outputDisabled && null !== $callback) {
  44882. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  44883. }
  44884. $this->resetProcessData();
  44885. $this->starttime = $this->lastOutputTime = microtime(true);
  44886. $this->callback = $this->buildCallback($callback);
  44887. $descriptors = $this->getDescriptors();
  44888. $commandline = $this->commandline;
  44889. if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  44890. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  44891. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  44892. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  44893. }
  44894. $commandline .= '"';
  44895. if (!isset($this->options['bypass_shell'])) {
  44896. $this->options['bypass_shell'] = true;
  44897. }
  44898. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  44899. $descriptors[3] = array('pipe', 'w');
  44900. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  44901. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  44902. $ptsWorkaround = fopen(__FILE__, 'r');
  44903. }
  44904. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  44905. if (!is_resource($this->process)) {
  44906. throw new RuntimeException('Unable to launch a new process.');
  44907. }
  44908. $this->status = self::STATUS_STARTED;
  44909. if (isset($descriptors[3])) {
  44910. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  44911. }
  44912. if ($this->tty) {
  44913. return;
  44914. }
  44915. $this->updateStatus(false);
  44916. $this->checkTimeout();
  44917. }
  44918. public function restart($callback = null)
  44919. {
  44920. if ($this->isRunning()) {
  44921. throw new RuntimeException('Process is already running');
  44922. }
  44923. $process = clone $this;
  44924. $process->start($callback);
  44925. return $process;
  44926. }
  44927. public function wait($callback = null)
  44928. {
  44929. $this->requireProcessIsStarted(__FUNCTION__);
  44930. $this->updateStatus(false);
  44931. if (null !== $callback) {
  44932. $this->callback = $this->buildCallback($callback);
  44933. }
  44934. do {
  44935. $this->checkTimeout();
  44936. $running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  44937. $this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
  44938. } while ($running);
  44939. while ($this->isRunning()) {
  44940. usleep(1000);
  44941. }
  44942. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  44943. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  44944. }
  44945. return $this->exitcode;
  44946. }
  44947. public function getPid()
  44948. {
  44949. return $this->isRunning() ? $this->processInformation['pid'] : null;
  44950. }
  44951. public function signal($signal)
  44952. {
  44953. $this->doSignal($signal, true);
  44954. return $this;
  44955. }
  44956. public function disableOutput()
  44957. {
  44958. if ($this->isRunning()) {
  44959. throw new RuntimeException('Disabling output while the process is running is not possible.');
  44960. }
  44961. if (null !== $this->idleTimeout) {
  44962. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  44963. }
  44964. $this->outputDisabled = true;
  44965. return $this;
  44966. }
  44967. public function enableOutput()
  44968. {
  44969. if ($this->isRunning()) {
  44970. throw new RuntimeException('Enabling output while the process is running is not possible.');
  44971. }
  44972. $this->outputDisabled = false;
  44973. return $this;
  44974. }
  44975. public function isOutputDisabled()
  44976. {
  44977. return $this->outputDisabled;
  44978. }
  44979. public function getOutput()
  44980. {
  44981. $this->readPipesForOutput(__FUNCTION__);
  44982. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  44983. return '';
  44984. }
  44985. return $ret;
  44986. }
  44987. public function getIncrementalOutput()
  44988. {
  44989. $this->readPipesForOutput(__FUNCTION__);
  44990. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  44991. $this->incrementalOutputOffset = ftell($this->stdout);
  44992. if (false === $latest) {
  44993. return '';
  44994. }
  44995. return $latest;
  44996. }
  44997. public function clearOutput()
  44998. {
  44999. ftruncate($this->stdout, 0);
  45000. fseek($this->stdout, 0);
  45001. $this->incrementalOutputOffset = 0;
  45002. return $this;
  45003. }
  45004. public function getErrorOutput()
  45005. {
  45006. $this->readPipesForOutput(__FUNCTION__);
  45007. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  45008. return '';
  45009. }
  45010. return $ret;
  45011. }
  45012. public function getIncrementalErrorOutput()
  45013. {
  45014. $this->readPipesForOutput(__FUNCTION__);
  45015. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  45016. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  45017. if (false === $latest) {
  45018. return '';
  45019. }
  45020. return $latest;
  45021. }
  45022. public function clearErrorOutput()
  45023. {
  45024. ftruncate($this->stderr, 0);
  45025. fseek($this->stderr, 0);
  45026. $this->incrementalErrorOutputOffset = 0;
  45027. return $this;
  45028. }
  45029. public function getExitCode()
  45030. {
  45031. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45032. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  45033. }
  45034. $this->updateStatus(false);
  45035. return $this->exitcode;
  45036. }
  45037. public function getExitCodeText()
  45038. {
  45039. if (null === $exitcode = $this->getExitCode()) {
  45040. return;
  45041. }
  45042. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  45043. }
  45044. public function isSuccessful()
  45045. {
  45046. return 0 === $this->getExitCode();
  45047. }
  45048. public function hasBeenSignaled()
  45049. {
  45050. $this->requireProcessIsTerminated(__FUNCTION__);
  45051. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45052. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  45053. }
  45054. return $this->processInformation['signaled'];
  45055. }
  45056. public function getTermSignal()
  45057. {
  45058. $this->requireProcessIsTerminated(__FUNCTION__);
  45059. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  45060. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  45061. }
  45062. return $this->processInformation['termsig'];
  45063. }
  45064. public function hasBeenStopped()
  45065. {
  45066. $this->requireProcessIsTerminated(__FUNCTION__);
  45067. return $this->processInformation['stopped'];
  45068. }
  45069. public function getStopSignal()
  45070. {
  45071. $this->requireProcessIsTerminated(__FUNCTION__);
  45072. return $this->processInformation['stopsig'];
  45073. }
  45074. public function isRunning()
  45075. {
  45076. if (self::STATUS_STARTED !== $this->status) {
  45077. return false;
  45078. }
  45079. $this->updateStatus(false);
  45080. return $this->processInformation['running'];
  45081. }
  45082. public function isStarted()
  45083. {
  45084. return self::STATUS_READY != $this->status;
  45085. }
  45086. public function isTerminated()
  45087. {
  45088. $this->updateStatus(false);
  45089. return self::STATUS_TERMINATED == $this->status;
  45090. }
  45091. public function getStatus()
  45092. {
  45093. $this->updateStatus(false);
  45094. return $this->status;
  45095. }
  45096. public function stop($timeout = 10, $signal = null)
  45097. {
  45098. $timeoutMicro = microtime(true) + $timeout;
  45099. if ($this->isRunning()) {
  45100. $this->doSignal(15, false);
  45101. do {
  45102. usleep(1000);
  45103. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  45104. if ($this->isRunning()) {
  45105. $this->doSignal($signal ?: 9, false);
  45106. }
  45107. }
  45108. if ($this->isRunning()) {
  45109. if (isset($this->fallbackStatus['pid'])) {
  45110. unset($this->fallbackStatus['pid']);
  45111. return $this->stop(0, $signal);
  45112. }
  45113. $this->close();
  45114. }
  45115. return $this->exitcode;
  45116. }
  45117. public function addOutput($line)
  45118. {
  45119. $this->lastOutputTime = microtime(true);
  45120. fseek($this->stdout, 0, SEEK_END);
  45121. fwrite($this->stdout, $line);
  45122. fseek($this->stdout, $this->incrementalOutputOffset);
  45123. }
  45124. public function addErrorOutput($line)
  45125. {
  45126. $this->lastOutputTime = microtime(true);
  45127. fseek($this->stderr, 0, SEEK_END);
  45128. fwrite($this->stderr, $line);
  45129. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  45130. }
  45131. public function getCommandLine()
  45132. {
  45133. return $this->commandline;
  45134. }
  45135. public function setCommandLine($commandline)
  45136. {
  45137. $this->commandline = $commandline;
  45138. return $this;
  45139. }
  45140. public function getTimeout()
  45141. {
  45142. return $this->timeout;
  45143. }
  45144. public function getIdleTimeout()
  45145. {
  45146. return $this->idleTimeout;
  45147. }
  45148. public function setTimeout($timeout)
  45149. {
  45150. $this->timeout = $this->validateTimeout($timeout);
  45151. return $this;
  45152. }
  45153. public function setIdleTimeout($timeout)
  45154. {
  45155. if (null !== $timeout && $this->outputDisabled) {
  45156. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  45157. }
  45158. $this->idleTimeout = $this->validateTimeout($timeout);
  45159. return $this;
  45160. }
  45161. public function setTty($tty)
  45162. {
  45163. if ('\\' === DIRECTORY_SEPARATOR && $tty) {
  45164. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  45165. }
  45166. if ($tty) {
  45167. static $isTtySupported;
  45168. if (null === $isTtySupported) {
  45169. $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);
  45170. }
  45171. if (!$isTtySupported) {
  45172. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  45173. }
  45174. }
  45175. $this->tty = (bool) $tty;
  45176. return $this;
  45177. }
  45178. public function isTty()
  45179. {
  45180. return $this->tty;
  45181. }
  45182. public function setPty($bool)
  45183. {
  45184. $this->pty = (bool) $bool;
  45185. return $this;
  45186. }
  45187. public function isPty()
  45188. {
  45189. return $this->pty;
  45190. }
  45191. public function getWorkingDirectory()
  45192. {
  45193. if (null === $this->cwd) {
  45194. return getcwd() ?: null;
  45195. }
  45196. return $this->cwd;
  45197. }
  45198. public function setWorkingDirectory($cwd)
  45199. {
  45200. $this->cwd = $cwd;
  45201. return $this;
  45202. }
  45203. public function getEnv()
  45204. {
  45205. return $this->env;
  45206. }
  45207. public function setEnv(array $env)
  45208. {
  45209. $env = array_filter($env, function ($value) {
  45210. return !is_array($value);
  45211. });
  45212. $this->env = array();
  45213. foreach ($env as $key => $value) {
  45214. $this->env[$key] = (string) $value;
  45215. }
  45216. return $this;
  45217. }
  45218. public function getStdin()
  45219. {
  45220. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  45221. return $this->getInput();
  45222. }
  45223. public function getInput()
  45224. {
  45225. return $this->input;
  45226. }
  45227. public function setStdin($stdin)
  45228. {
  45229. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  45230. return $this->setInput($stdin);
  45231. }
  45232. public function setInput($input)
  45233. {
  45234. if ($this->isRunning()) {
  45235. throw new LogicException('Input can not be set while the process is running.');
  45236. }
  45237. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  45238. return $this;
  45239. }
  45240. public function getOptions()
  45241. {
  45242. return $this->options;
  45243. }
  45244. public function setOptions(array $options)
  45245. {
  45246. $this->options = $options;
  45247. return $this;
  45248. }
  45249. public function getEnhanceWindowsCompatibility()
  45250. {
  45251. return $this->enhanceWindowsCompatibility;
  45252. }
  45253. public function setEnhanceWindowsCompatibility($enhance)
  45254. {
  45255. $this->enhanceWindowsCompatibility = (bool) $enhance;
  45256. return $this;
  45257. }
  45258. public function getEnhanceSigchildCompatibility()
  45259. {
  45260. return $this->enhanceSigchildCompatibility;
  45261. }
  45262. public function setEnhanceSigchildCompatibility($enhance)
  45263. {
  45264. $this->enhanceSigchildCompatibility = (bool) $enhance;
  45265. return $this;
  45266. }
  45267. public function checkTimeout()
  45268. {
  45269. if (self::STATUS_STARTED !== $this->status) {
  45270. return;
  45271. }
  45272. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  45273. $this->stop(0);
  45274. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  45275. }
  45276. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  45277. $this->stop(0);
  45278. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  45279. }
  45280. }
  45281. public static function isPtySupported()
  45282. {
  45283. static $result;
  45284. if (null !== $result) {
  45285. return $result;
  45286. }
  45287. if ('\\' === DIRECTORY_SEPARATOR) {
  45288. return $result = false;
  45289. }
  45290. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  45291. }
  45292. private function getDescriptors()
  45293. {
  45294. if ('\\' === DIRECTORY_SEPARATOR) {
  45295. $this->processPipes = WindowsPipes::create($this, $this->input);
  45296. } else {
  45297. $this->processPipes = UnixPipes::create($this, $this->input);
  45298. }
  45299. return $this->processPipes->getDescriptors();
  45300. }
  45301. protected function buildCallback($callback)
  45302. {
  45303. $that = $this;
  45304. $out = self::OUT;
  45305. $callback = function ($type, $data) use ($that, $callback, $out) {
  45306. if ($out == $type) {
  45307. $that->addOutput($data);
  45308. } else {
  45309. $that->addErrorOutput($data);
  45310. }
  45311. if (null !== $callback) {
  45312. call_user_func($callback, $type, $data);
  45313. }
  45314. };
  45315. return $callback;
  45316. }
  45317. protected function updateStatus($blocking)
  45318. {
  45319. if (self::STATUS_STARTED !== $this->status) {
  45320. return;
  45321. }
  45322. $this->processInformation = proc_get_status($this->process);
  45323. $running = $this->processInformation['running'];
  45324. $this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
  45325. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45326. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  45327. }
  45328. if (!$running) {
  45329. $this->close();
  45330. }
  45331. }
  45332. protected function isSigchildEnabled()
  45333. {
  45334. if (null !== self::$sigchild) {
  45335. return self::$sigchild;
  45336. }
  45337. if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
  45338. return self::$sigchild = false;
  45339. }
  45340. ob_start();
  45341. phpinfo(INFO_GENERAL);
  45342. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  45343. }
  45344. private function readPipesForOutput($caller)
  45345. {
  45346. if ($this->outputDisabled) {
  45347. throw new LogicException('Output has been disabled.');
  45348. }
  45349. $this->requireProcessIsStarted($caller);
  45350. $this->updateStatus(false);
  45351. }
  45352. private function validateTimeout($timeout)
  45353. {
  45354. $timeout = (float) $timeout;
  45355. if (0.0 === $timeout) {
  45356. $timeout = null;
  45357. } elseif ($timeout < 0) {
  45358. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  45359. }
  45360. return $timeout;
  45361. }
  45362. private function readPipes($blocking, $close)
  45363. {
  45364. $result = $this->processPipes->readAndWrite($blocking, $close);
  45365. $callback = $this->callback;
  45366. foreach ($result as $type => $data) {
  45367. if (3 !== $type) {
  45368. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  45369. } elseif (!isset($this->fallbackStatus['signaled'])) {
  45370. $this->fallbackStatus['exitcode'] = (int) $data;
  45371. }
  45372. }
  45373. }
  45374. private function close()
  45375. {
  45376. $this->processPipes->close();
  45377. if (is_resource($this->process)) {
  45378. proc_close($this->process);
  45379. }
  45380. $this->exitcode = $this->processInformation['exitcode'];
  45381. $this->status = self::STATUS_TERMINATED;
  45382. if (-1 === $this->exitcode) {
  45383. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  45384. $this->exitcode = 128 + $this->processInformation['termsig'];
  45385. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45386. $this->processInformation['signaled'] = true;
  45387. $this->processInformation['termsig'] = -1;
  45388. }
  45389. }
  45390. $this->callback = null;
  45391. return $this->exitcode;
  45392. }
  45393. private function resetProcessData()
  45394. {
  45395. $this->starttime = null;
  45396. $this->callback = null;
  45397. $this->exitcode = null;
  45398. $this->fallbackStatus = array();
  45399. $this->processInformation = null;
  45400. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  45401. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  45402. $this->process = null;
  45403. $this->latestSignal = null;
  45404. $this->status = self::STATUS_READY;
  45405. $this->incrementalOutputOffset = 0;
  45406. $this->incrementalErrorOutputOffset = 0;
  45407. }
  45408. private function doSignal($signal, $throwException)
  45409. {
  45410. if (null === $pid = $this->getPid()) {
  45411. if ($throwException) {
  45412. throw new LogicException('Can not send signal on a non running process.');
  45413. }
  45414. return false;
  45415. }
  45416. if ('\\' === DIRECTORY_SEPARATOR) {
  45417. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  45418. if ($exitCode && $this->isRunning()) {
  45419. if ($throwException) {
  45420. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  45421. }
  45422. return false;
  45423. }
  45424. } else {
  45425. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  45426. $ok = @proc_terminate($this->process, $signal);
  45427. } elseif (function_exists('posix_kill')) {
  45428. $ok = @posix_kill($pid, $signal);
  45429. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  45430. $ok = false === fgets($pipes[2]);
  45431. }
  45432. if (!$ok) {
  45433. if ($throwException) {
  45434. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  45435. }
  45436. return false;
  45437. }
  45438. }
  45439. $this->latestSignal = (int) $signal;
  45440. $this->fallbackStatus['signaled'] = true;
  45441. $this->fallbackStatus['exitcode'] = -1;
  45442. $this->fallbackStatus['termsig'] = $this->latestSignal;
  45443. return true;
  45444. }
  45445. private function requireProcessIsStarted($functionName)
  45446. {
  45447. if (!$this->isStarted()) {
  45448. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  45449. }
  45450. }
  45451. private function requireProcessIsTerminated($functionName)
  45452. {
  45453. if (!$this->isTerminated()) {
  45454. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  45455. }
  45456. }
  45457. }
  45458. <?php
  45459. namespace Symfony\Component\Process;
  45460. use Symfony\Component\Process\Exception\InvalidArgumentException;
  45461. use Symfony\Component\Process\Exception\LogicException;
  45462. class ProcessBuilder
  45463. {
  45464. private $arguments;
  45465. private $cwd;
  45466. private $env = array();
  45467. private $input;
  45468. private $timeout = 60;
  45469. private $options = array();
  45470. private $inheritEnv = true;
  45471. private $prefix = array();
  45472. private $outputDisabled = false;
  45473. public function __construct(array $arguments = array())
  45474. {
  45475. $this->arguments = $arguments;
  45476. }
  45477. public static function create(array $arguments = array())
  45478. {
  45479. return new static($arguments);
  45480. }
  45481. public function add($argument)
  45482. {
  45483. $this->arguments[] = $argument;
  45484. return $this;
  45485. }
  45486. public function setPrefix($prefix)
  45487. {
  45488. $this->prefix = is_array($prefix) ? $prefix : array($prefix);
  45489. return $this;
  45490. }
  45491. public function setArguments(array $arguments)
  45492. {
  45493. $this->arguments = $arguments;
  45494. return $this;
  45495. }
  45496. public function setWorkingDirectory($cwd)
  45497. {
  45498. $this->cwd = $cwd;
  45499. return $this;
  45500. }
  45501. public function inheritEnvironmentVariables($inheritEnv = true)
  45502. {
  45503. $this->inheritEnv = $inheritEnv;
  45504. return $this;
  45505. }
  45506. public function setEnv($name, $value)
  45507. {
  45508. $this->env[$name] = $value;
  45509. return $this;
  45510. }
  45511. public function addEnvironmentVariables(array $variables)
  45512. {
  45513. $this->env = array_replace($this->env, $variables);
  45514. return $this;
  45515. }
  45516. public function setInput($input)
  45517. {
  45518. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  45519. return $this;
  45520. }
  45521. public function setTimeout($timeout)
  45522. {
  45523. if (null === $timeout) {
  45524. $this->timeout = null;
  45525. return $this;
  45526. }
  45527. $timeout = (float) $timeout;
  45528. if ($timeout < 0) {
  45529. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  45530. }
  45531. $this->timeout = $timeout;
  45532. return $this;
  45533. }
  45534. public function setOption($name, $value)
  45535. {
  45536. $this->options[$name] = $value;
  45537. return $this;
  45538. }
  45539. public function disableOutput()
  45540. {
  45541. $this->outputDisabled = true;
  45542. return $this;
  45543. }
  45544. public function enableOutput()
  45545. {
  45546. $this->outputDisabled = false;
  45547. return $this;
  45548. }
  45549. public function getProcess()
  45550. {
  45551. if (0 === count($this->prefix) && 0 === count($this->arguments)) {
  45552. throw new LogicException('You must add() command arguments before calling getProcess().');
  45553. }
  45554. $options = $this->options;
  45555. $arguments = array_merge($this->prefix, $this->arguments);
  45556. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  45557. if ($this->inheritEnv) {
  45558. $env = array_replace($_ENV, $_SERVER, $this->env);
  45559. } else {
  45560. $env = $this->env;
  45561. }
  45562. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  45563. if ($this->outputDisabled) {
  45564. $process->disableOutput();
  45565. }
  45566. return $process;
  45567. }
  45568. }
  45569. <?php
  45570. namespace Symfony\Component\Process;
  45571. use Symfony\Component\Process\Exception\InvalidArgumentException;
  45572. class ProcessUtils
  45573. {
  45574. private function __construct()
  45575. {
  45576. }
  45577. public static function escapeArgument($argument)
  45578. {
  45579. if ('\\' === DIRECTORY_SEPARATOR) {
  45580. if ('' === $argument) {
  45581. return escapeshellarg($argument);
  45582. }
  45583. $escapedArgument = '';
  45584. $quote = false;
  45585. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  45586. if ('"' === $part) {
  45587. $escapedArgument .= '\\"';
  45588. } elseif (self::isSurroundedBy($part, '%')) {
  45589. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  45590. } else {
  45591. if ('\\' === substr($part, -1)) {
  45592. $part .= '\\';
  45593. }
  45594. $quote = true;
  45595. $escapedArgument .= $part;
  45596. }
  45597. }
  45598. if ($quote) {
  45599. $escapedArgument = '"'.$escapedArgument.'"';
  45600. }
  45601. return $escapedArgument;
  45602. }
  45603. return "'".str_replace("'", "'\\''", $argument)."'";
  45604. }
  45605. public static function validateInput($caller, $input)
  45606. {
  45607. if (null !== $input) {
  45608. if (is_resource($input)) {
  45609. return $input;
  45610. }
  45611. if (is_string($input)) {
  45612. return $input;
  45613. }
  45614. if (is_scalar($input)) {
  45615. return (string) $input;
  45616. }
  45617. if (is_object($input) && method_exists($input, '__toString')) {
  45618. @trigger_error('Passing an object as an input is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  45619. return (string) $input;
  45620. }
  45621. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  45622. }
  45623. return $input;
  45624. }
  45625. private static function isSurroundedBy($arg, $char)
  45626. {
  45627. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  45628. }
  45629. }
  45630. Copyright (c) 2011 Jordi Boggiano
  45631. Permission is hereby granted, free of charge, to any person obtaining a copy
  45632. of this software and associated documentation files (the "Software"), to deal
  45633. in the Software without restriction, including without limitation the rights
  45634. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  45635. copies of the Software, and to permit persons to whom the Software is furnished
  45636. to do so, subject to the following conditions:
  45637. The above copyright notice and this permission notice shall be included in all
  45638. copies or substantial portions of the Software.
  45639. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  45640. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  45641. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  45642. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  45643. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  45644. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  45645. THE SOFTWARE.
  45646. <?php
  45647. namespace Seld\JsonLint;
  45648. class DuplicateKeyException extends ParsingException
  45649. {
  45650. public function __construct($message, $key, array $details = array())
  45651. {
  45652. $details['key'] = $key;
  45653. parent::__construct($message, $details);
  45654. }
  45655. public function getKey()
  45656. {
  45657. return $this->details['key'];
  45658. }
  45659. }
  45660. <?php
  45661. namespace Seld\JsonLint;
  45662. use stdClass;
  45663. class JsonParser
  45664. {
  45665. const DETECT_KEY_CONFLICTS = 1;
  45666. const ALLOW_DUPLICATE_KEYS = 2;
  45667. const PARSE_TO_ASSOC = 4;
  45668. private $lexer;
  45669. private $flags;
  45670. private $stack;
  45671. private $vstack;
  45672. private $lstack;
  45673. private $symbols = array(
  45674. 'error' => 2,
  45675. 'JSONString' => 3,
  45676. 'STRING' => 4,
  45677. 'JSONNumber' => 5,
  45678. 'NUMBER' => 6,
  45679. 'JSONNullLiteral' => 7,
  45680. 'NULL' => 8,
  45681. 'JSONBooleanLiteral' => 9,
  45682. 'TRUE' => 10,
  45683. 'FALSE' => 11,
  45684. 'JSONText' => 12,
  45685. 'JSONValue' => 13,
  45686. 'EOF' => 14,
  45687. 'JSONObject' => 15,
  45688. 'JSONArray' => 16,
  45689. '{' => 17,
  45690. '}' => 18,
  45691. 'JSONMemberList' => 19,
  45692. 'JSONMember' => 20,
  45693. ':' => 21,
  45694. ',' => 22,
  45695. '[' => 23,
  45696. ']' => 24,
  45697. 'JSONElementList' => 25,
  45698. '$accept' => 0,
  45699. '$end' => 1,
  45700. );
  45701. private $terminals_ = array(
  45702. 2 => "error",
  45703. 4 => "STRING",
  45704. 6 => "NUMBER",
  45705. 8 => "NULL",
  45706. 10 => "TRUE",
  45707. 11 => "FALSE",
  45708. 14 => "EOF",
  45709. 17 => "{",
  45710. 18 => "}",
  45711. 21 => ":",
  45712. 22 => ",",
  45713. 23 => "[",
  45714. 24 => "]",
  45715. );
  45716. private $productions_ = array(
  45717. 0,
  45718. array(3, 1),
  45719. array(5, 1),
  45720. array(7, 1),
  45721. array(9, 1),
  45722. array(9, 1),
  45723. array(12, 2),
  45724. array(13, 1),
  45725. array(13, 1),
  45726. array(13, 1),
  45727. array(13, 1),
  45728. array(13, 1),
  45729. array(13, 1),
  45730. array(15, 2),
  45731. array(15, 3),
  45732. array(20, 3),
  45733. array(19, 1),
  45734. array(19, 3),
  45735. array(16, 2),
  45736. array(16, 3),
  45737. array(25, 1),
  45738. array(25, 3)
  45739. );
  45740. 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)),
  45741. );
  45742. private $defaultActions = array(
  45743. 16 => array(2, 6)
  45744. );
  45745. public function lint($input, $flags = 0)
  45746. {
  45747. try {
  45748. $this->parse($input, $flags);
  45749. } catch (ParsingException $e) {
  45750. return $e;
  45751. }
  45752. }
  45753. public function parse($input, $flags = 0)
  45754. {
  45755. $this->failOnBOM($input);
  45756. $this->flags = $flags;
  45757. $this->stack = array(0);
  45758. $this->vstack = array(null);
  45759. $this->lstack = array();
  45760. $yytext = '';
  45761. $yylineno = 0;
  45762. $yyleng = 0;
  45763. $recovering = 0;
  45764. $TERROR = 2;
  45765. $EOF = 1;
  45766. $this->lexer = new Lexer();
  45767. $this->lexer->setInput($input);
  45768. $yyloc = $this->lexer->yylloc;
  45769. $this->lstack[] = $yyloc;
  45770. $symbol = null;
  45771. $preErrorSymbol = null;
  45772. $state = null;
  45773. $action = null;
  45774. $a = null;
  45775. $r = null;
  45776. $yyval = new stdClass;
  45777. $p = null;
  45778. $len = null;
  45779. $newState = null;
  45780. $expected = null;
  45781. $errStr = null;
  45782. while (true) {
  45783. $state = $this->stack[count($this->stack)-1];
  45784. if (isset($this->defaultActions[$state])) {
  45785. $action = $this->defaultActions[$state];
  45786. } else {
  45787. if ($symbol == null) {
  45788. $symbol = $this->lex();
  45789. }
  45790. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  45791. }
  45792. if (!$action || !$action[0]) {
  45793. if (!$recovering) {
  45794. $expected = array();
  45795. foreach ($this->table[$state] as $p => $ignore) {
  45796. if (isset($this->terminals_[$p]) && $p > 2) {
  45797. $expected[] = "'" . $this->terminals_[$p] . "'";
  45798. }
  45799. }
  45800. $message = null;
  45801. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  45802. $message = "Invalid string";
  45803. if ("'" === substr($this->lexer->match, 0, 1)) {
  45804. $message .= ", it appears you used single quotes instead of double quotes";
  45805. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  45806. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  45807. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  45808. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  45809. }
  45810. }
  45811. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  45812. $errStr .= $this->lexer->showPosition() . "\n";
  45813. if ($message) {
  45814. $errStr .= $message;
  45815. } else {
  45816. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  45817. $errStr .= implode(', ', $expected);
  45818. }
  45819. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  45820. $errStr .= " - It appears you have an extra trailing comma";
  45821. }
  45822. $this->parseError($errStr, array(
  45823. 'text' => $this->lexer->match,
  45824. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  45825. 'line' => $this->lexer->yylineno,
  45826. 'loc' => $yyloc,
  45827. 'expected' => $expected,
  45828. ));
  45829. }
  45830. if ($recovering == 3) {
  45831. if ($symbol == $EOF) {
  45832. throw new ParsingException($errStr ?: 'Parsing halted.');
  45833. }
  45834. $yyleng = $this->lexer->yyleng;
  45835. $yytext = $this->lexer->yytext;
  45836. $yylineno = $this->lexer->yylineno;
  45837. $yyloc = $this->lexer->yylloc;
  45838. $symbol = $this->lex();
  45839. }
  45840. while (true) {
  45841. if (array_key_exists($TERROR, $this->table[$state])) {
  45842. break;
  45843. }
  45844. if ($state == 0) {
  45845. throw new ParsingException($errStr ?: 'Parsing halted.');
  45846. }
  45847. $this->popStack(1);
  45848. $state = $this->stack[count($this->stack)-1];
  45849. }
  45850. $preErrorSymbol = $symbol;
  45851. $symbol = $TERROR;
  45852. $state = $this->stack[count($this->stack)-1];
  45853. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  45854. $recovering = 3;
  45855. }
  45856. if (is_array($action[0]) && count($action) > 1) {
  45857. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  45858. }
  45859. switch ($action[0]) {
  45860. case 1:
  45861. $this->stack[] = $symbol;
  45862. $this->vstack[] = $this->lexer->yytext;
  45863. $this->lstack[] = $this->lexer->yylloc;
  45864. $this->stack[] = $action[1];
  45865. $symbol = null;
  45866. if (!$preErrorSymbol) {
  45867. $yyleng = $this->lexer->yyleng;
  45868. $yytext = $this->lexer->yytext;
  45869. $yylineno = $this->lexer->yylineno;
  45870. $yyloc = $this->lexer->yylloc;
  45871. if ($recovering > 0) {
  45872. $recovering--;
  45873. }
  45874. } else {
  45875. $symbol = $preErrorSymbol;
  45876. $preErrorSymbol = null;
  45877. }
  45878. break;
  45879. case 2:
  45880. $len = $this->productions_[$action[1]][1];
  45881. $yyval->token = $this->vstack[count($this->vstack) - $len];
  45882. $yyval->store = array(
  45883. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  45884. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  45885. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  45886. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  45887. );
  45888. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  45889. if (!$r instanceof Undefined) {
  45890. return $r;
  45891. }
  45892. if ($len) {
  45893. $this->popStack($len);
  45894. }
  45895. $this->stack[] = $this->productions_[$action[1]][0];
  45896. $this->vstack[] = $yyval->token;
  45897. $this->lstack[] = $yyval->store;
  45898. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  45899. $this->stack[] = $newState;
  45900. break;
  45901. case 3:
  45902. return true;
  45903. }
  45904. }
  45905. return true;
  45906. }
  45907. protected function parseError($str, $hash)
  45908. {
  45909. throw new ParsingException($str, $hash);
  45910. }
  45911. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  45912. {
  45913. $len = count($tokens) - 1;
  45914. switch ($yystate) {
  45915. case 1:
  45916. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  45917. $yyval->token = $yytext;
  45918. break;
  45919. case 2:
  45920. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  45921. $yyval->token = floatval($yytext);
  45922. } else {
  45923. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  45924. }
  45925. break;
  45926. case 3:
  45927. $yyval->token = null;
  45928. break;
  45929. case 4:
  45930. $yyval->token = true;
  45931. break;
  45932. case 5:
  45933. $yyval->token = false;
  45934. break;
  45935. case 6:
  45936. return $yyval->token = $tokens[$len-1];
  45937. case 13:
  45938. if ($this->flags & self::PARSE_TO_ASSOC) {
  45939. $yyval->token = array();
  45940. } else {
  45941. $yyval->token = new stdClass;
  45942. }
  45943. break;
  45944. case 14:
  45945. $yyval->token = $tokens[$len-1];
  45946. break;
  45947. case 15:
  45948. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  45949. break;
  45950. case 16:
  45951. if (PHP_VERSION_ID < 70100) {
  45952. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  45953. } else {
  45954. $property = $tokens[$len][0];
  45955. }
  45956. if ($this->flags & self::PARSE_TO_ASSOC) {
  45957. $yyval->token = array();
  45958. $yyval->token[$property] = $tokens[$len][1];
  45959. } else {
  45960. $yyval->token = new stdClass;
  45961. $yyval->token->$property = $tokens[$len][1];
  45962. }
  45963. break;
  45964. case 17:
  45965. if ($this->flags & self::PARSE_TO_ASSOC) {
  45966. $yyval->token =& $tokens[$len-2];
  45967. $key = $tokens[$len][0];
  45968. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  45969. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  45970. $errStr .= $this->lexer->showPosition() . "\n";
  45971. $errStr .= "Duplicate key: ".$tokens[$len][0];
  45972. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  45973. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  45974. $duplicateCount = 1;
  45975. do {
  45976. $duplicateKey = $key . '.' . $duplicateCount++;
  45977. } while (isset($tokens[$len-2][$duplicateKey]));
  45978. $key = $duplicateKey;
  45979. }
  45980. $tokens[$len-2][$key] = $tokens[$len][1];
  45981. } else {
  45982. $yyval->token = $tokens[$len-2];
  45983. if (PHP_VERSION_ID < 70100) {
  45984. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  45985. } else {
  45986. $key = $tokens[$len][0];
  45987. }
  45988. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  45989. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  45990. $errStr .= $this->lexer->showPosition() . "\n";
  45991. $errStr .= "Duplicate key: ".$tokens[$len][0];
  45992. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  45993. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  45994. $duplicateCount = 1;
  45995. do {
  45996. $duplicateKey = $key . '.' . $duplicateCount++;
  45997. } while (isset($tokens[$len-2]->$duplicateKey));
  45998. $key = $duplicateKey;
  45999. }
  46000. $tokens[$len-2]->$key = $tokens[$len][1];
  46001. }
  46002. break;
  46003. case 18:
  46004. $yyval->token = array();
  46005. break;
  46006. case 19:
  46007. $yyval->token = $tokens[$len-1];
  46008. break;
  46009. case 20:
  46010. $yyval->token = array($tokens[$len]);
  46011. break;
  46012. case 21:
  46013. $tokens[$len-2][] = $tokens[$len];
  46014. $yyval->token = $tokens[$len-2];
  46015. break;
  46016. }
  46017. return new Undefined();
  46018. }
  46019. private function stringInterpolation($match)
  46020. {
  46021. switch ($match[0]) {
  46022. case '\\\\':
  46023. return '\\';
  46024. case '\"':
  46025. return '"';
  46026. case '\b':
  46027. return chr(8);
  46028. case '\f':
  46029. return chr(12);
  46030. case '\n':
  46031. return "\n";
  46032. case '\r':
  46033. return "\r";
  46034. case '\t':
  46035. return "\t";
  46036. case '\/':
  46037. return "/";
  46038. default:
  46039. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
  46040. }
  46041. }
  46042. private function popStack($n)
  46043. {
  46044. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  46045. $this->vstack = array_slice($this->vstack, 0, - $n);
  46046. $this->lstack = array_slice($this->lstack, 0, - $n);
  46047. }
  46048. private function lex()
  46049. {
  46050. $token = $this->lexer->lex() ?: 1;
  46051. if (!is_numeric($token)) {
  46052. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  46053. }
  46054. return $token;
  46055. }
  46056. private function failOnBOM($input)
  46057. {
  46058. $bom = "\xEF\xBB\xBF";
  46059. if (substr($input, 0, 3) === $bom) {
  46060. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  46061. }
  46062. }
  46063. }
  46064. <?php
  46065. namespace Seld\JsonLint;
  46066. class Lexer
  46067. {
  46068. private $EOF = 1;
  46069. private $rules = array(
  46070. 0 => '/^\s+/',
  46071. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  46072. 2 => '{^"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  46073. 3 => '/^\{/',
  46074. 4 => '/^\}/',
  46075. 5 => '/^\[/',
  46076. 6 => '/^\]/',
  46077. 7 => '/^,/',
  46078. 8 => '/^:/',
  46079. 9 => '/^true\b/',
  46080. 10 => '/^false\b/',
  46081. 11 => '/^null\b/',
  46082. 12 => '/^$/',
  46083. 13 => '/^./',
  46084. );
  46085. private $conditions = array(
  46086. "INITIAL" => array(
  46087. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  46088. "inclusive" => true,
  46089. ),
  46090. );
  46091. private $conditionStack;
  46092. private $input;
  46093. private $more;
  46094. private $done;
  46095. private $matched;
  46096. public $match;
  46097. public $yylineno;
  46098. public $yyleng;
  46099. public $yytext;
  46100. public $yylloc;
  46101. public function lex()
  46102. {
  46103. $r = $this->next();
  46104. if (!$r instanceof Undefined) {
  46105. return $r;
  46106. }
  46107. return $this->lex();
  46108. }
  46109. public function setInput($input)
  46110. {
  46111. $this->input = $input;
  46112. $this->more = false;
  46113. $this->done = false;
  46114. $this->yylineno = $this->yyleng = 0;
  46115. $this->yytext = $this->matched = $this->match = '';
  46116. $this->conditionStack = array('INITIAL');
  46117. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  46118. return $this;
  46119. }
  46120. public function showPosition()
  46121. {
  46122. $pre = str_replace("\n", '', $this->getPastInput());
  46123. $c = str_repeat('-', max(0, strlen($pre) - 1));
  46124. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  46125. }
  46126. public function getPastInput()
  46127. {
  46128. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  46129. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  46130. }
  46131. public function getUpcomingInput()
  46132. {
  46133. $next = $this->match;
  46134. if (strlen($next) < 20) {
  46135. $next .= substr($this->input, 0, 20 - strlen($next));
  46136. }
  46137. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  46138. }
  46139. protected function parseError($str, $hash)
  46140. {
  46141. throw new \Exception($str);
  46142. }
  46143. private function next()
  46144. {
  46145. if ($this->done) {
  46146. return $this->EOF;
  46147. }
  46148. if ($this->input === '') {
  46149. $this->done = true;
  46150. }
  46151. $token = null;
  46152. $match = null;
  46153. $col = null;
  46154. $lines = null;
  46155. if (!$this->more) {
  46156. $this->yytext = '';
  46157. $this->match = '';
  46158. }
  46159. $rules = $this->getCurrentRules();
  46160. $rulesLen = count($rules);
  46161. for ($i=0; $i < $rulesLen; $i++) {
  46162. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  46163. preg_match_all('/\n.*/', $match[0], $lines);
  46164. $lines = $lines[0];
  46165. if ($lines) {
  46166. $this->yylineno += count($lines);
  46167. }
  46168. $this->yylloc = array(
  46169. 'first_line' => $this->yylloc['last_line'],
  46170. 'last_line' => $this->yylineno+1,
  46171. 'first_column' => $this->yylloc['last_column'],
  46172. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  46173. );
  46174. $this->yytext .= $match[0];
  46175. $this->match .= $match[0];
  46176. $this->yyleng = strlen($this->yytext);
  46177. $this->more = false;
  46178. $this->input = substr($this->input, strlen($match[0]));
  46179. $this->matched .= $match[0];
  46180. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  46181. if ($token) {
  46182. return $token;
  46183. }
  46184. return new Undefined();
  46185. }
  46186. }
  46187. if ($this->input === "") {
  46188. return $this->EOF;
  46189. }
  46190. $this->parseError(
  46191. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  46192. array(
  46193. 'text' => "",
  46194. 'token' => null,
  46195. 'line' => $this->yylineno,
  46196. )
  46197. );
  46198. }
  46199. private function getCurrentRules()
  46200. {
  46201. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  46202. }
  46203. private function performAction($avoiding_name_collisions, $YY_START)
  46204. {
  46205. switch ($avoiding_name_collisions) {
  46206. case 0:
  46207. break;
  46208. case 1:
  46209. return 6;
  46210. break;
  46211. case 2:
  46212. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  46213. return 4;
  46214. case 3:
  46215. return 17;
  46216. case 4:
  46217. return 18;
  46218. case 5:
  46219. return 23;
  46220. case 6:
  46221. return 24;
  46222. case 7:
  46223. return 22;
  46224. case 8:
  46225. return 21;
  46226. case 9:
  46227. return 10;
  46228. case 10:
  46229. return 11;
  46230. case 11:
  46231. return 8;
  46232. case 12:
  46233. return 14;
  46234. case 13:
  46235. return 'INVALID';
  46236. }
  46237. }
  46238. }
  46239. <?php
  46240. namespace Seld\JsonLint;
  46241. class ParsingException extends \Exception
  46242. {
  46243. protected $details;
  46244. public function __construct($message, $details = array())
  46245. {
  46246. $this->details = $details;
  46247. parent::__construct($message);
  46248. }
  46249. public function getDetails()
  46250. {
  46251. return $this->details;
  46252. }
  46253. }
  46254. <?php
  46255. namespace Seld\JsonLint;
  46256. class Undefined
  46257. {
  46258. }
  46259. Copyright (c) 2015 Jordi Boggiano
  46260. Permission is hereby granted, free of charge, to any person obtaining a copy
  46261. of this software and associated documentation files (the "Software"), to deal
  46262. in the Software without restriction, including without limitation the rights
  46263. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46264. copies of the Software, and to permit persons to whom the Software is furnished
  46265. to do so, subject to the following conditions:
  46266. The above copyright notice and this permission notice shall be included in all
  46267. copies or substantial portions of the Software.
  46268. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46269. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46270. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46271. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46272. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46273. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  46274. THE SOFTWARE.
  46275. <?php
  46276. require __DIR__.'/../vendor/autoload.php';
  46277. echo 'Say hello (visible): ';
  46278. $answer = Seld\CliPrompt\CliPrompt::prompt();
  46279. echo 'You answered: '.$answer . PHP_EOL;
  46280. echo 'Say hello (hidden): ';
  46281. $answer = Seld\CliPrompt\CliPrompt::hiddenPrompt();
  46282. echo 'You answered: '.$answer . PHP_EOL;
  46283. <?php
  46284. namespace Seld\CliPrompt;
  46285. class CliPrompt
  46286. {
  46287. public static function prompt()
  46288. {
  46289. $stdin = fopen('php://stdin', 'r');
  46290. $answer = self::trimAnswer(fgets($stdin, 4096));
  46291. fclose($stdin);
  46292. return $answer;
  46293. }
  46294. public static function hiddenPrompt($allowFallback = false)
  46295. {
  46296. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  46297. $exe = __DIR__.'\\..\\res\\hiddeninput.exe';
  46298. if ('phar:' === substr(__FILE__, 0, 5)) {
  46299. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  46300. $source = fopen($exe, 'r');
  46301. $target = fopen($tmpExe, 'w+');
  46302. stream_copy_to_stream($source, $target);
  46303. fclose($source);
  46304. fclose($target);
  46305. unset($source, $target);
  46306. $exe = $tmpExe;
  46307. }
  46308. $output = shell_exec($exe);
  46309. if (isset($tmpExe)) {
  46310. unlink($tmpExe);
  46311. }
  46312. if ($output !== null) {
  46313. echo PHP_EOL;
  46314. return self::trimAnswer($output);
  46315. }
  46316. }
  46317. if (file_exists('/usr/bin/env')) {
  46318. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  46319. foreach (array('bash', 'zsh', 'ksh', 'csh', 'sh') as $sh) {
  46320. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  46321. $shell = $sh;
  46322. break;
  46323. }
  46324. }
  46325. if (isset($shell)) {
  46326. $readCmd = ($shell === 'csh') ? 'set mypassword = $<' : 'read -r mypassword';
  46327. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  46328. $output = shell_exec($command);
  46329. if ($output !== null) {
  46330. echo PHP_EOL;
  46331. return self::trimAnswer($output);
  46332. }
  46333. }
  46334. }
  46335. if (!$allowFallback) {
  46336. throw new \RuntimeException('Could not prompt for input in a secure fashion, aborting');
  46337. }
  46338. return self::prompt();
  46339. }
  46340. private static function trimAnswer($str)
  46341. {
  46342. return preg_replace('{\r?\n$}D', '', $str);
  46343. }
  46344. }
  46345. MIT License
  46346. Copyright (c) 2016
  46347. Permission is hereby granted, free of charge, to any person obtaining a copy
  46348. of this software and associated documentation files (the "Software"), to deal
  46349. in the Software without restriction, including without limitation the rights
  46350. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46351. copies of the Software, and to permit persons to whom the Software is
  46352. furnished to do so, subject to the following conditions:
  46353. The above copyright notice and this permission notice shall be included in all
  46354. copies or substantial portions of the Software.
  46355. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46356. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46357. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46358. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46359. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46360. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  46361. SOFTWARE.
  46362. <?php
  46363. require __DIR__ . '/../vendor/autoload.php';
  46364. $data = json_decode(file_get_contents('data.json'));
  46365. $validator = new JsonSchema\Validator();
  46366. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  46367. if ($validator->isValid()) {
  46368. echo "The supplied JSON validates against the schema.\n";
  46369. } else {
  46370. echo "JSON does not validate. Violations:\n";
  46371. foreach ($validator->getErrors() as $error) {
  46372. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  46373. }
  46374. }
  46375. <?php
  46376. namespace JsonSchema\Constraints;
  46377. use JsonSchema\Entity\JsonPointer;
  46378. use JsonSchema\Exception\InvalidArgumentException;
  46379. use JsonSchema\Exception\ValidationException;
  46380. use JsonSchema\Validator;
  46381. class BaseConstraint
  46382. {
  46383. protected $errors = array();
  46384. protected $errorMask = Validator::ERROR_NONE;
  46385. protected $factory;
  46386. public function __construct(Factory $factory = null)
  46387. {
  46388. $this->factory = $factory ?: new Factory();
  46389. }
  46390. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  46391. {
  46392. $error = array(
  46393. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  46394. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  46395. 'message' => $message,
  46396. 'constraint' => $constraint,
  46397. 'context' => $this->factory->getErrorContext(),
  46398. );
  46399. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  46400. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  46401. }
  46402. if (is_array($more) && count($more) > 0) {
  46403. $error += $more;
  46404. }
  46405. $this->errors[] = $error;
  46406. $this->errorMask |= $error['context'];
  46407. }
  46408. public function addErrors(array $errors)
  46409. {
  46410. if ($errors) {
  46411. $this->errors = array_merge($this->errors, $errors);
  46412. $errorMask = &$this->errorMask;
  46413. array_walk($errors, function ($error) use (&$errorMask) {
  46414. if (isset($error['context'])) {
  46415. $errorMask |= $error['context'];
  46416. }
  46417. });
  46418. }
  46419. }
  46420. public function getErrors($errorContext = Validator::ERROR_ALL)
  46421. {
  46422. if ($errorContext === Validator::ERROR_ALL) {
  46423. return $this->errors;
  46424. }
  46425. return array_filter($this->errors, function ($error) use ($errorContext) {
  46426. if ($errorContext & $error['context']) {
  46427. return true;
  46428. }
  46429. });
  46430. }
  46431. public function numErrors($errorContext = Validator::ERROR_ALL)
  46432. {
  46433. if ($errorContext === Validator::ERROR_ALL) {
  46434. return count($this->errors);
  46435. }
  46436. return count($this->getErrors($errorContext));
  46437. }
  46438. public function isValid()
  46439. {
  46440. return !$this->getErrors();
  46441. }
  46442. public function reset()
  46443. {
  46444. $this->errors = array();
  46445. $this->errorMask = Validator::ERROR_NONE;
  46446. }
  46447. public function getErrorMask()
  46448. {
  46449. return $this->errorMask;
  46450. }
  46451. public static function arrayToObjectRecursive($array)
  46452. {
  46453. $json = json_encode($array);
  46454. if (json_last_error() !== \JSON_ERROR_NONE) {
  46455. $message = 'Unable to encode schema array as JSON';
  46456. if (function_exists('json_last_error_msg')) {
  46457. $message .= ': ' . json_last_error_msg();
  46458. }
  46459. throw new InvalidArgumentException($message);
  46460. }
  46461. return (object) json_decode($json);
  46462. }
  46463. }
  46464. <?php
  46465. namespace JsonSchema\Constraints;
  46466. use JsonSchema\Entity\JsonPointer;
  46467. class CollectionConstraint extends Constraint
  46468. {
  46469. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46470. {
  46471. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  46472. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  46473. }
  46474. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  46475. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  46476. }
  46477. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  46478. $unique = $value;
  46479. if (is_array($value) && count($value)) {
  46480. $unique = array_map(function ($e) {
  46481. return var_export($e, true);
  46482. }, $value);
  46483. }
  46484. if (count(array_unique($unique)) != count($value)) {
  46485. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  46486. }
  46487. }
  46488. if (isset($schema->items)) {
  46489. $this->validateItems($value, $schema, $path, $i);
  46490. }
  46491. }
  46492. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46493. {
  46494. if (is_object($schema->items)) {
  46495. if (isset($schema->items->type)
  46496. && (
  46497. $schema->items->type == 'string'
  46498. || $schema->items->type == 'number'
  46499. || $schema->items->type == 'integer'
  46500. )
  46501. && !isset($schema->additionalItems)
  46502. ) {
  46503. $type = $schema->items->type;
  46504. $typeValidator = $this->factory->createInstanceFor('type');
  46505. $validator = $this->factory->createInstanceFor($type === 'integer' ? 'number' : $type);
  46506. foreach ($value as $k => &$v) {
  46507. $k_path = $this->incrementPath($path, $k);
  46508. $typeValidator->check($v, $schema->items, $k_path, $i);
  46509. $validator->check($v, $schema->items, $k_path, $i);
  46510. }
  46511. unset($v);
  46512. $this->addErrors($typeValidator->getErrors());
  46513. $this->addErrors($validator->getErrors());
  46514. } else {
  46515. foreach ($value as $k => &$v) {
  46516. $initErrors = $this->getErrors();
  46517. $this->checkUndefined($v, $schema->items, $path, $k);
  46518. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  46519. $secondErrors = $this->getErrors();
  46520. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  46521. }
  46522. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  46523. $this->errors = $secondErrors;
  46524. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  46525. $this->errors = $initErrors;
  46526. }
  46527. }
  46528. unset($v);
  46529. }
  46530. } else {
  46531. foreach ($value as $k => &$v) {
  46532. if (array_key_exists($k, $schema->items)) {
  46533. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  46534. } else {
  46535. if (property_exists($schema, 'additionalItems')) {
  46536. if ($schema->additionalItems !== false) {
  46537. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  46538. } else {
  46539. $this->addError(
  46540. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  46541. }
  46542. } else {
  46543. $this->checkUndefined($v, new \stdClass(), $path, $k);
  46544. }
  46545. }
  46546. }
  46547. unset($v);
  46548. if (count($value) > 0) {
  46549. for ($k = count($value); $k < count($schema->items); $k++) {
  46550. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  46551. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  46552. }
  46553. }
  46554. }
  46555. }
  46556. }
  46557. <?php
  46558. namespace JsonSchema\Constraints;
  46559. use JsonSchema\Entity\JsonPointer;
  46560. use JsonSchema\SchemaStorage;
  46561. use JsonSchema\Uri\UriRetriever;
  46562. use JsonSchema\UriRetrieverInterface;
  46563. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  46564. {
  46565. protected $inlineSchemaProperty = '$schema';
  46566. const CHECK_MODE_NONE = 0x00000000;
  46567. const CHECK_MODE_NORMAL = 0x00000001;
  46568. const CHECK_MODE_TYPE_CAST = 0x00000002;
  46569. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  46570. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  46571. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  46572. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  46573. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  46574. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  46575. protected function incrementPath(JsonPointer $path = null, $i)
  46576. {
  46577. $path = $path ?: new JsonPointer('');
  46578. $path = $path->withPropertyPaths(
  46579. array_merge(
  46580. $path->getPropertyPaths(),
  46581. array_filter(array($i), 'strlen')
  46582. )
  46583. );
  46584. return $path;
  46585. }
  46586. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46587. {
  46588. $validator = $this->factory->createInstanceFor('collection');
  46589. $validator->check($value, $schema, $path, $i);
  46590. $this->addErrors($validator->getErrors());
  46591. }
  46592. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  46593. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  46594. {
  46595. $validator = $this->factory->createInstanceFor('object');
  46596. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  46597. $this->addErrors($validator->getErrors());
  46598. }
  46599. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46600. {
  46601. $validator = $this->factory->createInstanceFor('type');
  46602. $validator->check($value, $schema, $path, $i);
  46603. $this->addErrors($validator->getErrors());
  46604. }
  46605. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  46606. {
  46607. $validator = $this->factory->createInstanceFor('undefined');
  46608. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  46609. $this->addErrors($validator->getErrors());
  46610. }
  46611. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  46612. {
  46613. $validator = $this->factory->createInstanceFor('string');
  46614. $validator->check($value, $schema, $path, $i);
  46615. $this->addErrors($validator->getErrors());
  46616. }
  46617. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  46618. {
  46619. $validator = $this->factory->createInstanceFor('number');
  46620. $validator->check($value, $schema, $path, $i);
  46621. $this->addErrors($validator->getErrors());
  46622. }
  46623. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  46624. {
  46625. $validator = $this->factory->createInstanceFor('enum');
  46626. $validator->check($value, $schema, $path, $i);
  46627. $this->addErrors($validator->getErrors());
  46628. }
  46629. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  46630. {
  46631. $validator = $this->factory->createInstanceFor('format');
  46632. $validator->check($value, $schema, $path, $i);
  46633. $this->addErrors($validator->getErrors());
  46634. }
  46635. protected function getTypeCheck()
  46636. {
  46637. return $this->factory->getTypeCheck();
  46638. }
  46639. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  46640. {
  46641. $result = array_map(
  46642. function ($path) {
  46643. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  46644. },
  46645. $pointer->getPropertyPaths()
  46646. );
  46647. return trim(implode('', $result), '.');
  46648. }
  46649. }
  46650. <?php
  46651. namespace JsonSchema\Constraints;
  46652. use JsonSchema\Entity\JsonPointer;
  46653. interface ConstraintInterface
  46654. {
  46655. public function getErrors();
  46656. public function addErrors(array $errors);
  46657. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  46658. public function isValid();
  46659. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  46660. }
  46661. <?php
  46662. namespace JsonSchema\Constraints;
  46663. use JsonSchema\Entity\JsonPointer;
  46664. class EnumConstraint extends Constraint
  46665. {
  46666. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  46667. {
  46668. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  46669. return;
  46670. }
  46671. $type = gettype($element);
  46672. foreach ($schema->enum as $enum) {
  46673. $enumType = gettype($enum);
  46674. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  46675. if ((object) $element == $enum) {
  46676. return;
  46677. }
  46678. }
  46679. if ($type === gettype($enum)) {
  46680. if ($type == 'object') {
  46681. if ($element == $enum) {
  46682. return;
  46683. }
  46684. } elseif ($element === $enum) {
  46685. return;
  46686. }
  46687. }
  46688. }
  46689. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  46690. }
  46691. }
  46692. <?php
  46693. namespace JsonSchema\Constraints;
  46694. use JsonSchema\Constraints\Constraint;
  46695. use JsonSchema\Exception\InvalidArgumentException;
  46696. use JsonSchema\Exception\InvalidConfigException;
  46697. use JsonSchema\SchemaStorage;
  46698. use JsonSchema\SchemaStorageInterface;
  46699. use JsonSchema\Uri\UriRetriever;
  46700. use JsonSchema\UriRetrieverInterface;
  46701. use JsonSchema\Validator;
  46702. class Factory
  46703. {
  46704. protected $schemaStorage;
  46705. protected $uriRetriever;
  46706. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  46707. private $typeCheck = array();
  46708. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  46709. protected $constraintMap = array(
  46710. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  46711. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  46712. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  46713. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  46714. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  46715. 'string' => 'JsonSchema\Constraints\StringConstraint',
  46716. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  46717. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  46718. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  46719. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  46720. 'validator' => 'JsonSchema\Validator'
  46721. );
  46722. private $instanceCache = array();
  46723. public function __construct(
  46724. SchemaStorageInterface $schemaStorage = null,
  46725. UriRetrieverInterface $uriRetriever = null,
  46726. $checkMode = Constraint::CHECK_MODE_NORMAL
  46727. ) {
  46728. $this->setConfig($checkMode);
  46729. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  46730. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  46731. }
  46732. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  46733. {
  46734. $this->checkMode = $checkMode;
  46735. }
  46736. public function addConfig($options)
  46737. {
  46738. $this->checkMode |= $options;
  46739. }
  46740. public function removeConfig($options)
  46741. {
  46742. $this->checkMode &= ~$options;
  46743. }
  46744. public function getConfig($options = null)
  46745. {
  46746. if ($options === null) {
  46747. return $this->checkMode;
  46748. }
  46749. return $this->checkMode & $options;
  46750. }
  46751. public function getUriRetriever()
  46752. {
  46753. return $this->uriRetriever;
  46754. }
  46755. public function getSchemaStorage()
  46756. {
  46757. return $this->schemaStorage;
  46758. }
  46759. public function getTypeCheck()
  46760. {
  46761. if (!isset($this->typeCheck[$this->checkMode])) {
  46762. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  46763. ? new TypeCheck\LooseTypeCheck()
  46764. : new TypeCheck\StrictTypeCheck();
  46765. }
  46766. return $this->typeCheck[$this->checkMode];
  46767. }
  46768. public function setConstraintClass($name, $class)
  46769. {
  46770. if (!class_exists($class)) {
  46771. throw new InvalidArgumentException('Unknown constraint ' . $name);
  46772. }
  46773. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  46774. throw new InvalidArgumentException('Invalid class ' . $name);
  46775. }
  46776. $this->constraintMap[$name] = $class;
  46777. return $this;
  46778. }
  46779. public function createInstanceFor($constraintName)
  46780. {
  46781. if (!isset($this->constraintMap[$constraintName])) {
  46782. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  46783. }
  46784. if (!isset($this->instanceCache[$constraintName])) {
  46785. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  46786. }
  46787. return clone $this->instanceCache[$constraintName];
  46788. }
  46789. public function getErrorContext()
  46790. {
  46791. return $this->errorContext;
  46792. }
  46793. public function setErrorContext($errorContext)
  46794. {
  46795. $this->errorContext = $errorContext;
  46796. }
  46797. }
  46798. <?php
  46799. namespace JsonSchema\Constraints;
  46800. use JsonSchema\Entity\JsonPointer;
  46801. use JsonSchema\Rfc3339;
  46802. class FormatConstraint extends Constraint
  46803. {
  46804. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  46805. {
  46806. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  46807. return;
  46808. }
  46809. switch ($schema->format) {
  46810. case 'date':
  46811. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  46812. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  46813. }
  46814. break;
  46815. case 'time':
  46816. if (!$this->validateDateTime($element, 'H:i:s')) {
  46817. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  46818. }
  46819. break;
  46820. case 'date-time':
  46821. if (null === Rfc3339::createFromString($element)) {
  46822. $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));
  46823. }
  46824. break;
  46825. case 'utc-millisec':
  46826. if (!$this->validateDateTime($element, 'U')) {
  46827. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  46828. }
  46829. break;
  46830. case 'regex':
  46831. if (!$this->validateRegex($element)) {
  46832. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  46833. }
  46834. break;
  46835. case 'color':
  46836. if (!$this->validateColor($element)) {
  46837. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  46838. }
  46839. break;
  46840. case 'style':
  46841. if (!$this->validateStyle($element)) {
  46842. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  46843. }
  46844. break;
  46845. case 'phone':
  46846. if (!$this->validatePhone($element)) {
  46847. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  46848. }
  46849. break;
  46850. case 'uri':
  46851. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  46852. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  46853. }
  46854. break;
  46855. case 'uriref':
  46856. case 'uri-reference':
  46857. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  46858. if (substr($element, 0, 2) === '//') {
  46859. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  46860. } elseif (substr($element, 0, 1) === '/') {
  46861. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  46862. } elseif (strlen($element)) {
  46863. $pathParts = explode('/', $element, 2);
  46864. if (strpos($pathParts[0], ':') !== false) {
  46865. $validURL = null;
  46866. } else {
  46867. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  46868. }
  46869. } else {
  46870. $validURL = null;
  46871. }
  46872. if ($validURL === null) {
  46873. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  46874. }
  46875. }
  46876. break;
  46877. case 'email':
  46878. $filterFlags = FILTER_NULL_ON_FAILURE;
  46879. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  46880. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  46881. }
  46882. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  46883. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  46884. }
  46885. break;
  46886. case 'ip-address':
  46887. case 'ipv4':
  46888. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  46889. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  46890. }
  46891. break;
  46892. case 'ipv6':
  46893. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  46894. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  46895. }
  46896. break;
  46897. case 'host-name':
  46898. case 'hostname':
  46899. if (!$this->validateHostname($element)) {
  46900. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  46901. }
  46902. break;
  46903. default:
  46904. break;
  46905. }
  46906. }
  46907. protected function validateDateTime($datetime, $format)
  46908. {
  46909. $dt = \DateTime::createFromFormat($format, $datetime);
  46910. if (!$dt) {
  46911. return false;
  46912. }
  46913. if ($datetime === $dt->format($format)) {
  46914. return true;
  46915. }
  46916. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  46917. return true;
  46918. }
  46919. return false;
  46920. }
  46921. protected function validateRegex($regex)
  46922. {
  46923. return false !== @preg_match('/' . $regex . '/u', '');
  46924. }
  46925. protected function validateColor($color)
  46926. {
  46927. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  46928. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  46929. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  46930. return true;
  46931. }
  46932. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  46933. }
  46934. protected function validateStyle($style)
  46935. {
  46936. $properties = explode(';', rtrim($style, ';'));
  46937. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  46938. return empty($invalidEntries);
  46939. }
  46940. protected function validatePhone($phone)
  46941. {
  46942. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  46943. }
  46944. protected function validateHostname($host)
  46945. {
  46946. $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';
  46947. return preg_match($hostnameRegex, $host);
  46948. }
  46949. }
  46950. <?php
  46951. namespace JsonSchema\Constraints;
  46952. use JsonSchema\Entity\JsonPointer;
  46953. class NumberConstraint extends Constraint
  46954. {
  46955. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  46956. {
  46957. if (isset($schema->exclusiveMinimum)) {
  46958. if (isset($schema->minimum)) {
  46959. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  46960. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  46961. } elseif ($element < $schema->minimum) {
  46962. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  46963. }
  46964. } else {
  46965. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  46966. }
  46967. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  46968. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  46969. }
  46970. if (isset($schema->exclusiveMaximum)) {
  46971. if (isset($schema->maximum)) {
  46972. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  46973. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  46974. } elseif ($element > $schema->maximum) {
  46975. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  46976. }
  46977. } else {
  46978. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  46979. }
  46980. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  46981. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  46982. }
  46983. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  46984. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  46985. }
  46986. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  46987. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  46988. }
  46989. $this->checkFormat($element, $schema, $path, $i);
  46990. }
  46991. private function fmod($number1, $number2)
  46992. {
  46993. $number1 = abs($number1);
  46994. $modulus = fmod($number1, $number2);
  46995. $precision = abs(0.0000000001);
  46996. $diff = (float) ($modulus - $number2);
  46997. if (-$precision < $diff && $diff < $precision) {
  46998. return 0.0;
  46999. }
  47000. $decimals1 = mb_strpos($number1, '.') ? mb_strlen($number1) - mb_strpos($number1, '.') - 1 : 0;
  47001. $decimals2 = mb_strpos($number2, '.') ? mb_strlen($number2) - mb_strpos($number2, '.') - 1 : 0;
  47002. return (float) round($modulus, max($decimals1, $decimals2));
  47003. }
  47004. }
  47005. <?php
  47006. namespace JsonSchema\Constraints;
  47007. use JsonSchema\Entity\JsonPointer;
  47008. class ObjectConstraint extends Constraint
  47009. {
  47010. protected $appliedDefaults = array();
  47011. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  47012. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  47013. {
  47014. if ($element instanceof UndefinedConstraint) {
  47015. return;
  47016. }
  47017. $this->appliedDefaults = $appliedDefaults;
  47018. $matches = array();
  47019. if ($patternProperties) {
  47020. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  47021. }
  47022. if ($properties) {
  47023. $this->validateProperties($element, $properties, $path);
  47024. }
  47025. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  47026. }
  47027. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  47028. {
  47029. $try = array('/', '#', '+', '~', '%');
  47030. $matches = array();
  47031. foreach ($patternProperties as $pregex => $schema) {
  47032. $delimiter = '/';
  47033. foreach ($try as $delimiter) {
  47034. if (strpos($pregex, $delimiter) === false) {
  47035. break;
  47036. }
  47037. }
  47038. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  47039. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  47040. continue;
  47041. }
  47042. foreach ($element as $i => $value) {
  47043. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  47044. $matches[] = $i;
  47045. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  47046. }
  47047. }
  47048. }
  47049. return $matches;
  47050. }
  47051. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  47052. $properties = null, $additionalProp = null)
  47053. {
  47054. $this->validateMinMaxConstraint($element, $schema, $path);
  47055. foreach ($element as $i => $value) {
  47056. $definition = $this->getProperty($properties, $i);
  47057. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  47058. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  47059. }
  47060. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  47061. if ($additionalProp === true) {
  47062. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  47063. } else {
  47064. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  47065. }
  47066. }
  47067. $require = $this->getProperty($definition, 'requires');
  47068. if ($require && !$this->getProperty($element, $require)) {
  47069. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  47070. }
  47071. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  47072. if (is_object($property)) {
  47073. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  47074. }
  47075. }
  47076. }
  47077. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  47078. {
  47079. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  47080. foreach ($properties as $i => $value) {
  47081. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  47082. $definition = $this->getProperty($properties, $i);
  47083. if (is_object($definition)) {
  47084. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  47085. }
  47086. }
  47087. }
  47088. protected function &getProperty(&$element, $property, $fallback = null)
  47089. {
  47090. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  47091. return $element[$property];
  47092. } elseif (is_object($element) && property_exists($element, $property)) {
  47093. return $element->$property;
  47094. }
  47095. return $fallback;
  47096. }
  47097. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  47098. {
  47099. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  47100. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  47101. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  47102. }
  47103. }
  47104. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  47105. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  47106. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  47107. }
  47108. }
  47109. }
  47110. }
  47111. <?php
  47112. namespace JsonSchema\Constraints;
  47113. use JsonSchema\Entity\JsonPointer;
  47114. use JsonSchema\Exception\InvalidArgumentException;
  47115. use JsonSchema\Exception\InvalidSchemaException;
  47116. use JsonSchema\Exception\RuntimeException;
  47117. use JsonSchema\SchemaStorage;
  47118. use JsonSchema\Validator;
  47119. class SchemaConstraint extends Constraint
  47120. {
  47121. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  47122. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47123. {
  47124. if ($schema !== null) {
  47125. $validationSchema = $schema;
  47126. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  47127. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  47128. } else {
  47129. throw new InvalidArgumentException('no schema found to verify against');
  47130. }
  47131. if (is_array($validationSchema)) {
  47132. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  47133. }
  47134. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  47135. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  47136. throw new RuntimeException('Cannot validate the schema of a non-object');
  47137. }
  47138. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  47139. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  47140. } else {
  47141. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  47142. }
  47143. $schemaStorage = $this->factory->getSchemaStorage();
  47144. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  47145. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  47146. }
  47147. $initialErrorCount = $this->numErrors();
  47148. $initialConfig = $this->factory->getConfig();
  47149. $initialContext = $this->factory->getErrorContext();
  47150. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  47151. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  47152. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  47153. try {
  47154. $this->check($validationSchema, $schemaSpec);
  47155. } catch (\Exception $e) {
  47156. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  47157. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  47158. }
  47159. }
  47160. if ($this->numErrors() > $initialErrorCount) {
  47161. $this->addError($path, 'Schema is not valid', 'schema');
  47162. }
  47163. $this->factory->setConfig($initialConfig);
  47164. $this->factory->setErrorContext($initialContext);
  47165. }
  47166. $this->checkUndefined($element, $validationSchema, $path, $i);
  47167. }
  47168. }
  47169. <?php
  47170. namespace JsonSchema\Constraints;
  47171. use JsonSchema\Entity\JsonPointer;
  47172. class StringConstraint extends Constraint
  47173. {
  47174. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47175. {
  47176. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  47177. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  47178. 'maxLength' => $schema->maxLength,
  47179. ));
  47180. }
  47181. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  47182. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  47183. 'minLength' => $schema->minLength,
  47184. ));
  47185. }
  47186. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  47187. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  47188. 'pattern' => $schema->pattern,
  47189. ));
  47190. }
  47191. $this->checkFormat($element, $schema, $path, $i);
  47192. }
  47193. private function strlen($string)
  47194. {
  47195. if (extension_loaded('mbstring')) {
  47196. return mb_strlen($string, mb_detect_encoding($string));
  47197. }
  47198. return strlen($string);
  47199. }
  47200. }
  47201. <?php
  47202. namespace JsonSchema\Constraints\TypeCheck;
  47203. class LooseTypeCheck implements TypeCheckInterface
  47204. {
  47205. public static function isObject($value)
  47206. {
  47207. return
  47208. is_object($value) ||
  47209. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  47210. }
  47211. public static function isArray($value)
  47212. {
  47213. return
  47214. is_array($value) &&
  47215. (count($value) == 0 || !self::isAssociativeArray($value));
  47216. }
  47217. public static function propertyGet($value, $property)
  47218. {
  47219. if (is_object($value)) {
  47220. return $value->{$property};
  47221. }
  47222. return $value[$property];
  47223. }
  47224. public static function propertySet(&$value, $property, $data)
  47225. {
  47226. if (is_object($value)) {
  47227. $value->{$property} = $data;
  47228. } else {
  47229. $value[$property] = $data;
  47230. }
  47231. }
  47232. public static function propertyExists($value, $property)
  47233. {
  47234. if (is_object($value)) {
  47235. return property_exists($value, $property);
  47236. }
  47237. return array_key_exists($property, $value);
  47238. }
  47239. public static function propertyCount($value)
  47240. {
  47241. if (is_object($value)) {
  47242. return count(get_object_vars($value));
  47243. }
  47244. return count($value);
  47245. }
  47246. private static function isAssociativeArray($arr)
  47247. {
  47248. return array_keys($arr) !== range(0, count($arr) - 1);
  47249. }
  47250. }
  47251. <?php
  47252. namespace JsonSchema\Constraints\TypeCheck;
  47253. class StrictTypeCheck implements TypeCheckInterface
  47254. {
  47255. public static function isObject($value)
  47256. {
  47257. return is_object($value);
  47258. }
  47259. public static function isArray($value)
  47260. {
  47261. return is_array($value);
  47262. }
  47263. public static function propertyGet($value, $property)
  47264. {
  47265. return $value->{$property};
  47266. }
  47267. public static function propertySet(&$value, $property, $data)
  47268. {
  47269. $value->{$property} = $data;
  47270. }
  47271. public static function propertyExists($value, $property)
  47272. {
  47273. return property_exists($value, $property);
  47274. }
  47275. public static function propertyCount($value)
  47276. {
  47277. return count(get_object_vars($value));
  47278. }
  47279. }
  47280. <?php
  47281. namespace JsonSchema\Constraints\TypeCheck;
  47282. interface TypeCheckInterface
  47283. {
  47284. public static function isObject($value);
  47285. public static function isArray($value);
  47286. public static function propertyGet($value, $property);
  47287. public static function propertySet(&$value, $property, $data);
  47288. public static function propertyExists($value, $property);
  47289. public static function propertyCount($value);
  47290. }
  47291. <?php
  47292. namespace JsonSchema\Constraints;
  47293. use JsonSchema\Entity\JsonPointer;
  47294. use JsonSchema\Exception\InvalidArgumentException;
  47295. use UnexpectedValueException as StandardUnexpectedValueException;
  47296. class TypeConstraint extends Constraint
  47297. {
  47298. public static $wording = array(
  47299. 'integer' => 'an integer',
  47300. 'number' => 'a number',
  47301. 'boolean' => 'a boolean',
  47302. 'object' => 'an object',
  47303. 'array' => 'an array',
  47304. 'string' => 'a string',
  47305. 'null' => 'a null',
  47306. 'any' => null,
  47307. 0 => null,
  47308. );
  47309. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  47310. {
  47311. $type = isset($schema->type) ? $schema->type : null;
  47312. $isValid = false;
  47313. $wording = array();
  47314. if (is_array($type)) {
  47315. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  47316. } elseif (is_object($type)) {
  47317. $this->checkUndefined($value, $type, $path);
  47318. return;
  47319. } else {
  47320. $isValid = $this->validateType($value, $type);
  47321. }
  47322. if ($isValid === false) {
  47323. if (!is_array($type)) {
  47324. $this->validateTypeNameWording($type);
  47325. $wording[] = self::$wording[$type];
  47326. }
  47327. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  47328. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  47329. }
  47330. }
  47331. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  47332. {
  47333. foreach ($type as $tp) {
  47334. if (is_object($tp)) {
  47335. if (!$isValid) {
  47336. $validator = $this->factory->createInstanceFor('type');
  47337. $subSchema = new \stdClass();
  47338. $subSchema->type = $tp;
  47339. $validator->check($value, $subSchema, $path, null);
  47340. $error = $validator->getErrors();
  47341. $isValid = !(bool) $error;
  47342. $validTypesWording[] = self::$wording['object'];
  47343. }
  47344. } else {
  47345. $this->validateTypeNameWording($tp);
  47346. $validTypesWording[] = self::$wording[$tp];
  47347. if (!$isValid) {
  47348. $isValid = $this->validateType($value, $tp);
  47349. }
  47350. }
  47351. }
  47352. }
  47353. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  47354. {
  47355. if ($listEnd === false || !isset($elements[1])) {
  47356. return implode($delimiter, $elements);
  47357. }
  47358. $lastElement = array_slice($elements, -1);
  47359. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  47360. $implodedElements = array_merge(array($firsElements), $lastElement);
  47361. return join(" $listEnd ", $implodedElements);
  47362. }
  47363. protected function validateTypeNameWording($type)
  47364. {
  47365. if (!isset(self::$wording[$type])) {
  47366. throw new StandardUnexpectedValueException(
  47367. sprintf(
  47368. 'No wording for %s available, expected wordings are: [%s]',
  47369. var_export($type, true),
  47370. implode(', ', array_filter(self::$wording)))
  47371. );
  47372. }
  47373. }
  47374. protected function validateType(&$value, $type)
  47375. {
  47376. if (!$type) {
  47377. return true;
  47378. }
  47379. if ('any' === $type) {
  47380. return true;
  47381. }
  47382. if ('object' === $type) {
  47383. return $this->getTypeCheck()->isObject($value);
  47384. }
  47385. if ('array' === $type) {
  47386. return $this->getTypeCheck()->isArray($value);
  47387. }
  47388. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  47389. if ('integer' === $type) {
  47390. if ($coerce) {
  47391. $value = $this->toInteger($value);
  47392. }
  47393. return is_int($value);
  47394. }
  47395. if ('number' === $type) {
  47396. if ($coerce) {
  47397. $value = $this->toNumber($value);
  47398. }
  47399. return is_numeric($value) && !is_string($value);
  47400. }
  47401. if ('boolean' === $type) {
  47402. if ($coerce) {
  47403. $value = $this->toBoolean($value);
  47404. }
  47405. return is_bool($value);
  47406. }
  47407. if ('string' === $type) {
  47408. return is_string($value);
  47409. }
  47410. if ('email' === $type) {
  47411. return is_string($value);
  47412. }
  47413. if ('null' === $type) {
  47414. return is_null($value);
  47415. }
  47416. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  47417. }
  47418. protected function toBoolean($value)
  47419. {
  47420. if ($value === 'true') {
  47421. return true;
  47422. }
  47423. if ($value === 'false') {
  47424. return false;
  47425. }
  47426. return $value;
  47427. }
  47428. protected function toNumber($value)
  47429. {
  47430. if (is_numeric($value)) {
  47431. return $value + 0;
  47432. }
  47433. return $value;
  47434. }
  47435. protected function toInteger($value)
  47436. {
  47437. if (is_numeric($value) && (int) $value == $value) {
  47438. return (int) $value;
  47439. }
  47440. return $value;
  47441. }
  47442. }
  47443. <?php
  47444. namespace JsonSchema\Constraints;
  47445. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  47446. use JsonSchema\Entity\JsonPointer;
  47447. use JsonSchema\Exception\ValidationException;
  47448. use JsonSchema\Uri\UriResolver;
  47449. class UndefinedConstraint extends Constraint
  47450. {
  47451. protected $appliedDefaults = array();
  47452. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  47453. {
  47454. if (is_null($schema) || !is_object($schema)) {
  47455. return;
  47456. }
  47457. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  47458. if ($fromDefault) {
  47459. $path->setFromDefault();
  47460. }
  47461. $this->validateCommonProperties($value, $schema, $path, $i);
  47462. $this->validateOfProperties($value, $schema, $path, '');
  47463. $this->validateTypes($value, $schema, $path, $i);
  47464. }
  47465. public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null)
  47466. {
  47467. if ($this->getTypeCheck()->isArray($value)) {
  47468. $this->checkArray($value, $schema, $path, $i);
  47469. }
  47470. if (LooseTypeCheck::isObject($value)) {
  47471. $this->checkObject(
  47472. $value,
  47473. $schema,
  47474. $path,
  47475. isset($schema->properties) ? $schema->properties : null,
  47476. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  47477. isset($schema->patternProperties) ? $schema->patternProperties : null,
  47478. $this->appliedDefaults
  47479. );
  47480. }
  47481. if (is_string($value)) {
  47482. $this->checkString($value, $schema, $path, $i);
  47483. }
  47484. if (is_numeric($value)) {
  47485. $this->checkNumber($value, $schema, $path, $i);
  47486. }
  47487. if (isset($schema->enum)) {
  47488. $this->checkEnum($value, $schema, $path, $i);
  47489. }
  47490. }
  47491. protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '')
  47492. {
  47493. if (isset($schema->extends)) {
  47494. if (is_string($schema->extends)) {
  47495. $schema->extends = $this->validateUri($schema, $schema->extends);
  47496. }
  47497. if (is_array($schema->extends)) {
  47498. foreach ($schema->extends as $extends) {
  47499. $this->checkUndefined($value, $extends, $path, $i);
  47500. }
  47501. } else {
  47502. $this->checkUndefined($value, $schema->extends, $path, $i);
  47503. }
  47504. }
  47505. if (!$path->fromDefault()) {
  47506. $this->applyDefaultValues($value, $schema, $path);
  47507. }
  47508. if ($this->getTypeCheck()->isObject($value)) {
  47509. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  47510. foreach ($schema->required as $required) {
  47511. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  47512. $this->addError(
  47513. $this->incrementPath($path ?: new JsonPointer(''), $required),
  47514. 'The property ' . $required . ' is required',
  47515. 'required'
  47516. );
  47517. }
  47518. }
  47519. } elseif (isset($schema->required) && !is_array($schema->required)) {
  47520. if ($schema->required && $value instanceof self) {
  47521. $propertyPaths = $path->getPropertyPaths();
  47522. $propertyName = end($propertyPaths);
  47523. $this->addError(
  47524. $path,
  47525. 'The property ' . $propertyName . ' is required',
  47526. 'required'
  47527. );
  47528. }
  47529. }
  47530. }
  47531. if (!($value instanceof self)) {
  47532. $this->checkType($value, $schema, $path, $i);
  47533. }
  47534. if (isset($schema->disallow)) {
  47535. $initErrors = $this->getErrors();
  47536. $typeSchema = new \stdClass();
  47537. $typeSchema->type = $schema->disallow;
  47538. $this->checkType($value, $typeSchema, $path);
  47539. if (count($this->getErrors()) == count($initErrors)) {
  47540. $this->addError($path, 'Disallowed value was matched', 'disallow');
  47541. } else {
  47542. $this->errors = $initErrors;
  47543. }
  47544. }
  47545. if (isset($schema->not)) {
  47546. $initErrors = $this->getErrors();
  47547. $this->checkUndefined($value, $schema->not, $path, $i);
  47548. if (count($this->getErrors()) == count($initErrors)) {
  47549. $this->addError($path, 'Matched a schema which it should not', 'not');
  47550. } else {
  47551. $this->errors = $initErrors;
  47552. }
  47553. }
  47554. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  47555. $this->validateDependencies($value, $schema->dependencies, $path);
  47556. }
  47557. }
  47558. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  47559. {
  47560. if (!$requiredOnly) {
  47561. return true;
  47562. }
  47563. if (
  47564. $name !== null
  47565. && isset($parentSchema->required)
  47566. && is_array($parentSchema->required)
  47567. && in_array($name, $parentSchema->required)
  47568. ) {
  47569. return true;
  47570. }
  47571. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  47572. return true;
  47573. }
  47574. return false;
  47575. }
  47576. protected function applyDefaultValues(&$value, $schema, $path)
  47577. {
  47578. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  47579. return;
  47580. }
  47581. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  47582. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  47583. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  47584. if (
  47585. !LooseTypeCheck::propertyExists($value, $currentProperty)
  47586. && property_exists($propertyDefinition, 'default')
  47587. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  47588. ) {
  47589. if (is_object($propertyDefinition->default)) {
  47590. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  47591. } else {
  47592. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  47593. }
  47594. $this->appliedDefaults[] = $currentProperty;
  47595. }
  47596. }
  47597. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  47598. $items = array();
  47599. if (LooseTypeCheck::isArray($schema->items)) {
  47600. $items = $schema->items;
  47601. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  47602. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  47603. }
  47604. foreach ($items as $currentItem => $itemDefinition) {
  47605. if (
  47606. !array_key_exists($currentItem, $value)
  47607. && property_exists($itemDefinition, 'default')
  47608. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  47609. if (is_object($itemDefinition->default)) {
  47610. $value[$currentItem] = clone $itemDefinition->default;
  47611. } else {
  47612. $value[$currentItem] = $itemDefinition->default;
  47613. }
  47614. }
  47615. $path->setFromDefault();
  47616. }
  47617. } elseif (
  47618. $value instanceof self
  47619. && property_exists($schema, 'default')
  47620. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  47621. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  47622. $path->setFromDefault();
  47623. }
  47624. }
  47625. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  47626. {
  47627. if ($value instanceof self) {
  47628. return;
  47629. }
  47630. if (isset($schema->allOf)) {
  47631. $isValid = true;
  47632. foreach ($schema->allOf as $allOf) {
  47633. $initErrors = $this->getErrors();
  47634. $this->checkUndefined($value, $allOf, $path, $i);
  47635. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  47636. }
  47637. if (!$isValid) {
  47638. $this->addError($path, 'Failed to match all schemas', 'allOf');
  47639. }
  47640. }
  47641. if (isset($schema->anyOf)) {
  47642. $isValid = false;
  47643. $startErrors = $this->getErrors();
  47644. $caughtException = null;
  47645. foreach ($schema->anyOf as $anyOf) {
  47646. $initErrors = $this->getErrors();
  47647. try {
  47648. $this->checkUndefined($value, $anyOf, $path, $i);
  47649. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  47650. break;
  47651. }
  47652. } catch (ValidationException $e) {
  47653. $isValid = false;
  47654. }
  47655. }
  47656. if (!$isValid) {
  47657. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  47658. } else {
  47659. $this->errors = $startErrors;
  47660. }
  47661. }
  47662. if (isset($schema->oneOf)) {
  47663. $allErrors = array();
  47664. $matchedSchemas = 0;
  47665. $startErrors = $this->getErrors();
  47666. foreach ($schema->oneOf as $oneOf) {
  47667. try {
  47668. $this->errors = array();
  47669. $this->checkUndefined($value, $oneOf, $path, $i);
  47670. if (count($this->getErrors()) == 0) {
  47671. $matchedSchemas++;
  47672. }
  47673. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  47674. } catch (ValidationException $e) {
  47675. }
  47676. }
  47677. if ($matchedSchemas !== 1) {
  47678. $this->addErrors(array_merge($allErrors, $startErrors));
  47679. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  47680. } else {
  47681. $this->errors = $startErrors;
  47682. }
  47683. }
  47684. }
  47685. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  47686. {
  47687. foreach ($dependencies as $key => $dependency) {
  47688. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  47689. if (is_string($dependency)) {
  47690. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  47691. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  47692. }
  47693. } elseif (is_array($dependency)) {
  47694. foreach ($dependency as $d) {
  47695. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  47696. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  47697. }
  47698. }
  47699. } elseif (is_object($dependency)) {
  47700. $this->checkUndefined($value, $dependency, $path, $i);
  47701. }
  47702. }
  47703. }
  47704. }
  47705. protected function validateUri($schema, $schemaUri = null)
  47706. {
  47707. $resolver = new UriResolver();
  47708. $retriever = $this->factory->getUriRetriever();
  47709. $jsonSchema = null;
  47710. if ($resolver->isValid($schemaUri)) {
  47711. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  47712. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  47713. }
  47714. return $jsonSchema;
  47715. }
  47716. }
  47717. <?php
  47718. namespace JsonSchema\Entity;
  47719. use JsonSchema\Exception\InvalidArgumentException;
  47720. class JsonPointer
  47721. {
  47722. private $filename;
  47723. private $propertyPaths = array();
  47724. private $fromDefault = false;
  47725. public function __construct($value)
  47726. {
  47727. if (!is_string($value)) {
  47728. throw new InvalidArgumentException('Ref value must be a string');
  47729. }
  47730. $splitRef = explode('#', $value, 2);
  47731. $this->filename = $splitRef[0];
  47732. if (array_key_exists(1, $splitRef)) {
  47733. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  47734. }
  47735. }
  47736. private function decodePropertyPaths($propertyPathString)
  47737. {
  47738. $paths = array();
  47739. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  47740. $path = $this->decodePath($path);
  47741. if (is_string($path) && '' !== $path) {
  47742. $paths[] = $path;
  47743. }
  47744. }
  47745. return $paths;
  47746. }
  47747. private function encodePropertyPaths()
  47748. {
  47749. return array_map(
  47750. array($this, 'encodePath'),
  47751. $this->getPropertyPaths()
  47752. );
  47753. }
  47754. private function decodePath($path)
  47755. {
  47756. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  47757. }
  47758. private function encodePath($path)
  47759. {
  47760. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  47761. }
  47762. public function getFilename()
  47763. {
  47764. return $this->filename;
  47765. }
  47766. public function getPropertyPaths()
  47767. {
  47768. return $this->propertyPaths;
  47769. }
  47770. public function withPropertyPaths(array $propertyPaths)
  47771. {
  47772. $new = clone $this;
  47773. $new->propertyPaths = $propertyPaths;
  47774. return $new;
  47775. }
  47776. public function getPropertyPathAsString()
  47777. {
  47778. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  47779. }
  47780. public function __toString()
  47781. {
  47782. return $this->getFilename() . $this->getPropertyPathAsString();
  47783. }
  47784. public function setFromDefault()
  47785. {
  47786. $this->fromDefault = true;
  47787. }
  47788. public function fromDefault()
  47789. {
  47790. return $this->fromDefault;
  47791. }
  47792. }
  47793. <?php
  47794. namespace JsonSchema\Exception;
  47795. interface ExceptionInterface
  47796. {
  47797. }
  47798. <?php
  47799. namespace JsonSchema\Exception;
  47800. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  47801. {
  47802. }
  47803. <?php
  47804. namespace JsonSchema\Exception;
  47805. class InvalidConfigException extends RuntimeException
  47806. {
  47807. }
  47808. <?php
  47809. namespace JsonSchema\Exception;
  47810. class InvalidSchemaException extends RuntimeException
  47811. {
  47812. }
  47813. <?php
  47814. namespace JsonSchema\Exception;
  47815. class InvalidSchemaMediaTypeException extends RuntimeException
  47816. {
  47817. }
  47818. <?php
  47819. namespace JsonSchema\Exception;
  47820. class InvalidSourceUriException extends InvalidArgumentException
  47821. {
  47822. }
  47823. <?php
  47824. namespace JsonSchema\Exception;
  47825. class JsonDecodingException extends RuntimeException
  47826. {
  47827. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  47828. {
  47829. switch ($code) {
  47830. case JSON_ERROR_DEPTH:
  47831. $message = 'The maximum stack depth has been exceeded';
  47832. break;
  47833. case JSON_ERROR_STATE_MISMATCH:
  47834. $message = 'Invalid or malformed JSON';
  47835. break;
  47836. case JSON_ERROR_CTRL_CHAR:
  47837. $message = 'Control character error, possibly incorrectly encoded';
  47838. break;
  47839. case JSON_ERROR_UTF8:
  47840. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  47841. break;
  47842. case JSON_ERROR_SYNTAX:
  47843. $message = 'JSON syntax is malformed';
  47844. break;
  47845. default:
  47846. $message = 'Syntax error';
  47847. }
  47848. parent::__construct($message, $code, $previous);
  47849. }
  47850. }
  47851. <?php
  47852. namespace JsonSchema\Exception;
  47853. class ResourceNotFoundException extends RuntimeException
  47854. {
  47855. }
  47856. <?php
  47857. namespace JsonSchema\Exception;
  47858. class RuntimeException extends \RuntimeException implements ExceptionInterface
  47859. {
  47860. }
  47861. <?php
  47862. namespace JsonSchema\Exception;
  47863. class UnresolvableJsonPointerException extends InvalidArgumentException
  47864. {
  47865. }
  47866. <?php
  47867. namespace JsonSchema\Exception;
  47868. class UriResolverException extends RuntimeException
  47869. {
  47870. }
  47871. <?php
  47872. namespace JsonSchema\Exception;
  47873. class ValidationException extends RuntimeException
  47874. {
  47875. }
  47876. <?php
  47877. namespace JsonSchema\Iterator;
  47878. class ObjectIterator implements \Iterator, \Countable
  47879. {
  47880. private $object;
  47881. private $position = 0;
  47882. private $data = array();
  47883. private $initialized = false;
  47884. public function __construct($object)
  47885. {
  47886. $this->object = $object;
  47887. }
  47888. public function current()
  47889. {
  47890. $this->initialize();
  47891. return $this->data[$this->position];
  47892. }
  47893. public function next()
  47894. {
  47895. $this->initialize();
  47896. $this->position++;
  47897. }
  47898. public function key()
  47899. {
  47900. $this->initialize();
  47901. return $this->position;
  47902. }
  47903. public function valid()
  47904. {
  47905. $this->initialize();
  47906. return isset($this->data[$this->position]);
  47907. }
  47908. public function rewind()
  47909. {
  47910. $this->initialize();
  47911. $this->position = 0;
  47912. }
  47913. public function count()
  47914. {
  47915. $this->initialize();
  47916. return count($this->data);
  47917. }
  47918. private function initialize()
  47919. {
  47920. if (!$this->initialized) {
  47921. $this->data = $this->buildDataFromObject($this->object);
  47922. $this->initialized = true;
  47923. }
  47924. }
  47925. private function buildDataFromObject($object)
  47926. {
  47927. $result = array();
  47928. $stack = new \SplStack();
  47929. $stack->push($object);
  47930. while (!$stack->isEmpty()) {
  47931. $current = $stack->pop();
  47932. if (is_object($current)) {
  47933. array_push($result, $current);
  47934. }
  47935. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  47936. if (is_object($propertyValue) || is_array($propertyValue)) {
  47937. $stack->push($propertyValue);
  47938. }
  47939. }
  47940. }
  47941. return $result;
  47942. }
  47943. private function getDataFromItem($item)
  47944. {
  47945. if (!is_object($item) && !is_array($item)) {
  47946. return array();
  47947. }
  47948. return is_object($item) ? get_object_vars($item) : $item;
  47949. }
  47950. }
  47951. <?php
  47952. namespace JsonSchema;
  47953. class Rfc3339
  47954. {
  47955. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  47956. public static function createFromString($string)
  47957. {
  47958. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  47959. return null;
  47960. }
  47961. $dateAndTime = $matches[1];
  47962. $microseconds = $matches[2] ?: '.000000';
  47963. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  47964. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  47965. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  47966. return $dateTime ?: null;
  47967. }
  47968. }
  47969. <?php
  47970. namespace JsonSchema;
  47971. use JsonSchema\Constraints\BaseConstraint;
  47972. use JsonSchema\Entity\JsonPointer;
  47973. use JsonSchema\Exception\UnresolvableJsonPointerException;
  47974. use JsonSchema\Uri\UriResolver;
  47975. use JsonSchema\Uri\UriRetriever;
  47976. class SchemaStorage implements SchemaStorageInterface
  47977. {
  47978. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  47979. protected $uriRetriever;
  47980. protected $uriResolver;
  47981. protected $schemas = array();
  47982. public function __construct(
  47983. UriRetrieverInterface $uriRetriever = null,
  47984. UriResolverInterface $uriResolver = null
  47985. ) {
  47986. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  47987. $this->uriResolver = $uriResolver ?: new UriResolver();
  47988. }
  47989. public function getUriRetriever()
  47990. {
  47991. return $this->uriRetriever;
  47992. }
  47993. public function getUriResolver()
  47994. {
  47995. return $this->uriResolver;
  47996. }
  47997. public function addSchema($id, $schema = null)
  47998. {
  47999. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  48000. $schema = $this->uriRetriever->retrieve($id);
  48001. }
  48002. if (is_array($schema)) {
  48003. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  48004. }
  48005. if (is_object($schema) && property_exists($schema, 'id')) {
  48006. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  48007. $schema->properties->id->format = 'uri-reference';
  48008. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  48009. $schema->properties->id->format = 'uri-reference';
  48010. $schema->properties->{'$ref'}->format = 'uri-reference';
  48011. }
  48012. }
  48013. $this->expandRefs($schema, $id);
  48014. $this->schemas[$id] = $schema;
  48015. }
  48016. private function expandRefs(&$schema, $base = null)
  48017. {
  48018. if (!is_object($schema)) {
  48019. if (is_array($schema)) {
  48020. foreach ($schema as &$member) {
  48021. $this->expandRefs($member, $base);
  48022. }
  48023. }
  48024. return;
  48025. }
  48026. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  48027. $base = $this->uriResolver->resolve($schema->id, $base);
  48028. }
  48029. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  48030. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  48031. $schema->{'$ref'} = (string) $refPointer;
  48032. }
  48033. foreach ($schema as &$member) {
  48034. $this->expandRefs($member, $base);
  48035. }
  48036. }
  48037. public function getSchema($id)
  48038. {
  48039. if (!array_key_exists($id, $this->schemas)) {
  48040. $this->addSchema($id);
  48041. }
  48042. return $this->schemas[$id];
  48043. }
  48044. public function resolveRef($ref)
  48045. {
  48046. $jsonPointer = new JsonPointer($ref);
  48047. $fileName = $jsonPointer->getFilename();
  48048. if (!strlen($fileName)) {
  48049. throw new UnresolvableJsonPointerException(sprintf(
  48050. "Could not resolve fragment '%s': no file is defined",
  48051. $jsonPointer->getPropertyPathAsString()
  48052. ));
  48053. }
  48054. $refSchema = $this->getSchema($fileName);
  48055. foreach ($jsonPointer->getPropertyPaths() as $path) {
  48056. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  48057. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  48058. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  48059. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  48060. } else {
  48061. throw new UnresolvableJsonPointerException(sprintf(
  48062. 'File: %s is found, but could not resolve fragment: %s',
  48063. $jsonPointer->getFilename(),
  48064. $jsonPointer->getPropertyPathAsString()
  48065. ));
  48066. }
  48067. }
  48068. return $refSchema;
  48069. }
  48070. public function resolveRefSchema($refSchema)
  48071. {
  48072. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  48073. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  48074. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  48075. unset($refSchema->{'$ref'});
  48076. }
  48077. return $refSchema;
  48078. }
  48079. }
  48080. <?php
  48081. namespace JsonSchema;
  48082. interface SchemaStorageInterface
  48083. {
  48084. public function addSchema($id, $schema = null);
  48085. public function getSchema($id);
  48086. public function resolveRef($ref);
  48087. public function resolveRefSchema($refSchema);
  48088. }
  48089. <?php
  48090. namespace JsonSchema\Uri\Retrievers;
  48091. abstract class AbstractRetriever implements UriRetrieverInterface
  48092. {
  48093. protected $contentType;
  48094. public function getContentType()
  48095. {
  48096. return $this->contentType;
  48097. }
  48098. }
  48099. <?php
  48100. namespace JsonSchema\Uri\Retrievers;
  48101. use JsonSchema\Exception\RuntimeException;
  48102. use JsonSchema\Validator;
  48103. class Curl extends AbstractRetriever
  48104. {
  48105. protected $messageBody;
  48106. public function __construct()
  48107. {
  48108. if (!function_exists('curl_init')) {
  48109. throw new RuntimeException('cURL not installed');
  48110. }
  48111. }
  48112. public function retrieve($uri)
  48113. {
  48114. $ch = curl_init();
  48115. curl_setopt($ch, CURLOPT_URL, $uri);
  48116. curl_setopt($ch, CURLOPT_HEADER, true);
  48117. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  48118. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  48119. $response = curl_exec($ch);
  48120. if (false === $response) {
  48121. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  48122. }
  48123. $this->fetchMessageBody($response);
  48124. $this->fetchContentType($response);
  48125. curl_close($ch);
  48126. return $this->messageBody;
  48127. }
  48128. private function fetchMessageBody($response)
  48129. {
  48130. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  48131. $this->messageBody = $match[1];
  48132. }
  48133. protected function fetchContentType($response)
  48134. {
  48135. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  48136. $this->contentType = trim($match[1]);
  48137. return true;
  48138. }
  48139. return false;
  48140. }
  48141. }
  48142. <?php
  48143. namespace JsonSchema\Uri\Retrievers;
  48144. use JsonSchema\Exception\ResourceNotFoundException;
  48145. class FileGetContents extends AbstractRetriever
  48146. {
  48147. protected $messageBody;
  48148. public function retrieve($uri)
  48149. {
  48150. $errorMessage = null;
  48151. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  48152. $errorMessage = $errstr;
  48153. });
  48154. $response = file_get_contents($uri);
  48155. restore_error_handler();
  48156. if ($errorMessage) {
  48157. throw new ResourceNotFoundException($errorMessage);
  48158. }
  48159. if (false === $response) {
  48160. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  48161. }
  48162. if ($response == ''
  48163. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  48164. ) {
  48165. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  48166. }
  48167. $this->messageBody = $response;
  48168. if (!empty($http_response_header)) {
  48169. $this->fetchContentType($http_response_header);
  48170. } else {
  48171. $this->contentType = null;
  48172. }
  48173. return $this->messageBody;
  48174. }
  48175. private function fetchContentType(array $headers)
  48176. {
  48177. foreach ($headers as $header) {
  48178. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  48179. return true;
  48180. }
  48181. }
  48182. return false;
  48183. }
  48184. protected static function getContentTypeMatchInHeader($header)
  48185. {
  48186. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  48187. return trim($match[1]);
  48188. }
  48189. return null;
  48190. }
  48191. }
  48192. <?php
  48193. namespace JsonSchema\Uri\Retrievers;
  48194. use JsonSchema\Validator;
  48195. class PredefinedArray extends AbstractRetriever
  48196. {
  48197. private $schemas;
  48198. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  48199. {
  48200. $this->schemas = $schemas;
  48201. $this->contentType = $contentType;
  48202. }
  48203. public function retrieve($uri)
  48204. {
  48205. if (!array_key_exists($uri, $this->schemas)) {
  48206. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  48207. 'The JSON schema "%s" was not found.',
  48208. $uri
  48209. ));
  48210. }
  48211. return $this->schemas[$uri];
  48212. }
  48213. }
  48214. <?php
  48215. namespace JsonSchema\Uri\Retrievers;
  48216. interface UriRetrieverInterface
  48217. {
  48218. public function retrieve($uri);
  48219. public function getContentType();
  48220. }
  48221. <?php
  48222. namespace JsonSchema\Uri;
  48223. use JsonSchema\Exception\UriResolverException;
  48224. use JsonSchema\UriResolverInterface;
  48225. class UriResolver implements UriResolverInterface
  48226. {
  48227. public function parse($uri)
  48228. {
  48229. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  48230. $components = array();
  48231. if (5 < count($match)) {
  48232. $components = array(
  48233. 'scheme' => $match[2],
  48234. 'authority' => $match[4],
  48235. 'path' => $match[5]
  48236. );
  48237. }
  48238. if (7 < count($match)) {
  48239. $components['query'] = $match[7];
  48240. }
  48241. if (9 < count($match)) {
  48242. $components['fragment'] = $match[9];
  48243. }
  48244. return $components;
  48245. }
  48246. public function generate(array $components)
  48247. {
  48248. $uri = $components['scheme'] . '://'
  48249. . $components['authority']
  48250. . $components['path'];
  48251. if (array_key_exists('query', $components) && strlen($components['query'])) {
  48252. $uri .= '?' . $components['query'];
  48253. }
  48254. if (array_key_exists('fragment', $components)) {
  48255. $uri .= '#' . $components['fragment'];
  48256. }
  48257. return $uri;
  48258. }
  48259. public function resolve($uri, $baseUri = null)
  48260. {
  48261. if (
  48262. !is_null($baseUri) &&
  48263. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  48264. !preg_match('|^[^/]+://|u', $baseUri)
  48265. ) {
  48266. if (is_file($baseUri)) {
  48267. $baseUri = 'file://' . realpath($baseUri);
  48268. } elseif (is_dir($baseUri)) {
  48269. $baseUri = 'file://' . realpath($baseUri) . '/';
  48270. } else {
  48271. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  48272. }
  48273. }
  48274. if ($uri == '') {
  48275. return $baseUri;
  48276. }
  48277. $components = $this->parse($uri);
  48278. $path = $components['path'];
  48279. if (!empty($components['scheme'])) {
  48280. return $uri;
  48281. }
  48282. $baseComponents = $this->parse($baseUri);
  48283. $basePath = $baseComponents['path'];
  48284. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  48285. if (isset($components['fragment'])) {
  48286. $baseComponents['fragment'] = $components['fragment'];
  48287. }
  48288. return $this->generate($baseComponents);
  48289. }
  48290. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  48291. {
  48292. $relativePath = self::normalizePath($relativePath);
  48293. if ($relativePath == '') {
  48294. return $basePath;
  48295. }
  48296. if ($relativePath[0] == '/') {
  48297. return $relativePath;
  48298. }
  48299. $basePathSegments = explode('/', $basePath);
  48300. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  48301. $numLevelUp = strlen($match[0]) /3 + 1;
  48302. if ($numLevelUp >= count($basePathSegments)) {
  48303. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  48304. }
  48305. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  48306. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  48307. return implode('/', $basePathSegments) . '/' . $path;
  48308. }
  48309. private static function normalizePath($path)
  48310. {
  48311. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  48312. $path = preg_replace('|//|', '/', $path);
  48313. return $path;
  48314. }
  48315. public function isValid($uri)
  48316. {
  48317. $components = $this->parse($uri);
  48318. return !empty($components);
  48319. }
  48320. }
  48321. <?php
  48322. namespace JsonSchema\Uri;
  48323. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  48324. use JsonSchema\Exception\JsonDecodingException;
  48325. use JsonSchema\Exception\ResourceNotFoundException;
  48326. use JsonSchema\Uri\Retrievers\FileGetContents;
  48327. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  48328. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  48329. use JsonSchema\Validator;
  48330. class UriRetriever implements BaseUriRetrieverInterface
  48331. {
  48332. protected $translationMap = array(
  48333. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  48334. );
  48335. protected $uriRetriever = null;
  48336. private $schemaCache = array();
  48337. public function confirmMediaType($uriRetriever, $uri)
  48338. {
  48339. $contentType = $uriRetriever->getContentType();
  48340. if (is_null($contentType)) {
  48341. return;
  48342. }
  48343. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  48344. return;
  48345. }
  48346. if (substr($uri, 0, 23) == 'http://json-schema.org/') {
  48347. return true;
  48348. }
  48349. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  48350. }
  48351. public function getUriRetriever()
  48352. {
  48353. if (is_null($this->uriRetriever)) {
  48354. $this->setUriRetriever(new FileGetContents());
  48355. }
  48356. return $this->uriRetriever;
  48357. }
  48358. public function resolvePointer($jsonSchema, $uri)
  48359. {
  48360. $resolver = new UriResolver();
  48361. $parsed = $resolver->parse($uri);
  48362. if (empty($parsed['fragment'])) {
  48363. return $jsonSchema;
  48364. }
  48365. $path = explode('/', $parsed['fragment']);
  48366. while ($path) {
  48367. $pathElement = array_shift($path);
  48368. if (!empty($pathElement)) {
  48369. $pathElement = str_replace('~1', '/', $pathElement);
  48370. $pathElement = str_replace('~0', '~', $pathElement);
  48371. if (!empty($jsonSchema->$pathElement)) {
  48372. $jsonSchema = $jsonSchema->$pathElement;
  48373. } else {
  48374. throw new ResourceNotFoundException(
  48375. 'Fragment "' . $parsed['fragment'] . '" not found'
  48376. . ' in ' . $uri
  48377. );
  48378. }
  48379. if (!is_object($jsonSchema)) {
  48380. throw new ResourceNotFoundException(
  48381. 'Fragment part "' . $pathElement . '" is no object '
  48382. . ' in ' . $uri
  48383. );
  48384. }
  48385. }
  48386. }
  48387. return $jsonSchema;
  48388. }
  48389. public function retrieve($uri, $baseUri = null, $translate = true)
  48390. {
  48391. $resolver = new UriResolver();
  48392. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  48393. $arParts = $resolver->parse($resolvedUri);
  48394. if (isset($arParts['fragment'])) {
  48395. unset($arParts['fragment']);
  48396. $fetchUri = $resolver->generate($arParts);
  48397. }
  48398. if ($translate) {
  48399. $fetchUri = $this->translate($fetchUri);
  48400. }
  48401. $jsonSchema = $this->loadSchema($fetchUri);
  48402. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  48403. if ($jsonSchema instanceof \stdClass) {
  48404. $jsonSchema->id = $resolvedUri;
  48405. }
  48406. return $jsonSchema;
  48407. }
  48408. protected function loadSchema($fetchUri)
  48409. {
  48410. if (isset($this->schemaCache[$fetchUri])) {
  48411. return $this->schemaCache[$fetchUri];
  48412. }
  48413. $uriRetriever = $this->getUriRetriever();
  48414. $contents = $this->uriRetriever->retrieve($fetchUri);
  48415. $this->confirmMediaType($uriRetriever, $fetchUri);
  48416. $jsonSchema = json_decode($contents);
  48417. if (JSON_ERROR_NONE < $error = json_last_error()) {
  48418. throw new JsonDecodingException($error);
  48419. }
  48420. $this->schemaCache[$fetchUri] = $jsonSchema;
  48421. return $jsonSchema;
  48422. }
  48423. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  48424. {
  48425. $this->uriRetriever = $uriRetriever;
  48426. return $this;
  48427. }
  48428. public function parse($uri)
  48429. {
  48430. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  48431. $components = array();
  48432. if (5 < count($match)) {
  48433. $components = array(
  48434. 'scheme' => $match[2],
  48435. 'authority' => $match[4],
  48436. 'path' => $match[5]
  48437. );
  48438. }
  48439. if (7 < count($match)) {
  48440. $components['query'] = $match[7];
  48441. }
  48442. if (9 < count($match)) {
  48443. $components['fragment'] = $match[9];
  48444. }
  48445. return $components;
  48446. }
  48447. public function generate(array $components)
  48448. {
  48449. $uri = $components['scheme'] . '://'
  48450. . $components['authority']
  48451. . $components['path'];
  48452. if (array_key_exists('query', $components)) {
  48453. $uri .= $components['query'];
  48454. }
  48455. if (array_key_exists('fragment', $components)) {
  48456. $uri .= $components['fragment'];
  48457. }
  48458. return $uri;
  48459. }
  48460. public function resolve($uri, $baseUri = null)
  48461. {
  48462. $components = $this->parse($uri);
  48463. $path = $components['path'];
  48464. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  48465. return $uri;
  48466. }
  48467. $baseComponents = $this->parse($baseUri);
  48468. $basePath = $baseComponents['path'];
  48469. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  48470. return $this->generate($baseComponents);
  48471. }
  48472. public function isValid($uri)
  48473. {
  48474. $components = $this->parse($uri);
  48475. return !empty($components);
  48476. }
  48477. public function setTranslation($from, $to)
  48478. {
  48479. $this->translationMap[$from] = $to;
  48480. }
  48481. public function translate($uri)
  48482. {
  48483. foreach ($this->translationMap as $from => $to) {
  48484. $uri = preg_replace($from, $to, $uri);
  48485. }
  48486. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  48487. return $uri;
  48488. }
  48489. }
  48490. <?php
  48491. namespace JsonSchema;
  48492. interface UriResolverInterface
  48493. {
  48494. public function resolve($uri, $baseUri = null);
  48495. }
  48496. <?php
  48497. namespace JsonSchema;
  48498. interface UriRetrieverInterface
  48499. {
  48500. public function retrieve($uri, $baseUri = null);
  48501. }
  48502. <?php
  48503. namespace JsonSchema;
  48504. use JsonSchema\Constraints\BaseConstraint;
  48505. use JsonSchema\Constraints\Constraint;
  48506. use JsonSchema\Exception\InvalidConfigException;
  48507. use JsonSchema\SchemaStorage;
  48508. class Validator extends BaseConstraint
  48509. {
  48510. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  48511. const ERROR_NONE = 0x00000000;
  48512. const ERROR_ALL = 0xFFFFFFFF;
  48513. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  48514. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  48515. public function validate(&$value, $schema = null, $checkMode = null)
  48516. {
  48517. if (is_array($schema)) {
  48518. $schema = self::arrayToObjectRecursive($schema);
  48519. }
  48520. $initialCheckMode = $this->factory->getConfig();
  48521. if ($checkMode !== null) {
  48522. $this->factory->setConfig($checkMode);
  48523. }
  48524. if (is_object($schema) && property_exists($schema, 'id')) {
  48525. $schemaURI = $schema->id;
  48526. } else {
  48527. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  48528. }
  48529. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  48530. $validator = $this->factory->createInstanceFor('schema');
  48531. $validator->check(
  48532. $value,
  48533. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  48534. );
  48535. $this->factory->setConfig($initialCheckMode);
  48536. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  48537. return $validator->getErrorMask();
  48538. }
  48539. public function check($value, $schema)
  48540. {
  48541. return $this->validate($value, $schema);
  48542. }
  48543. public function coerce(&$value, $schema)
  48544. {
  48545. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  48546. }
  48547. }
  48548. Copyright (C) 2015 Composer
  48549. Permission is hereby granted, free of charge, to any person obtaining a copy of
  48550. this software and associated documentation files (the "Software"), to deal in
  48551. the Software without restriction, including without limitation the rights to
  48552. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  48553. of the Software, and to permit persons to whom the Software is furnished to do
  48554. so, subject to the following conditions:
  48555. The above copyright notice and this permission notice shall be included in all
  48556. copies or substantial portions of the Software.
  48557. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48558. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48559. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48560. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48561. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48562. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  48563. SOFTWARE.
  48564. <?php
  48565. namespace Composer\Spdx;
  48566. class SpdxLicenses
  48567. {
  48568. const LICENSES_FILE = 'spdx-licenses.json';
  48569. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  48570. private $licenses;
  48571. private $licensesExpression;
  48572. private $exceptions;
  48573. private $exceptionsExpression;
  48574. public function __construct()
  48575. {
  48576. $this->loadLicenses();
  48577. $this->loadExceptions();
  48578. }
  48579. public function getLicenseByIdentifier($identifier)
  48580. {
  48581. $key = strtolower($identifier);
  48582. if (!isset($this->licenses[$key])) {
  48583. return;
  48584. }
  48585. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  48586. return array(
  48587. $name,
  48588. $isOsiApproved,
  48589. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  48590. $isDeprecatedLicenseId,
  48591. );
  48592. }
  48593. public function getLicenses()
  48594. {
  48595. return $this->licenses;
  48596. }
  48597. public function getExceptionByIdentifier($identifier)
  48598. {
  48599. $key = strtolower($identifier);
  48600. if (!isset($this->exceptions[$key])) {
  48601. return;
  48602. }
  48603. list($identifier, $name) = $this->exceptions[$key];
  48604. return array(
  48605. $name,
  48606. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  48607. );
  48608. }
  48609. public function getIdentifierByName($name)
  48610. {
  48611. foreach ($this->licenses as $licenseData) {
  48612. if ($licenseData[1] === $name) {
  48613. return $licenseData[0];
  48614. }
  48615. }
  48616. foreach ($this->exceptions as $licenseData) {
  48617. if ($licenseData[1] === $name) {
  48618. return $licenseData[0];
  48619. }
  48620. }
  48621. }
  48622. public function isOsiApprovedByIdentifier($identifier)
  48623. {
  48624. return $this->licenses[strtolower($identifier)][2];
  48625. }
  48626. public function isDeprecatedByIdentifier($identifier)
  48627. {
  48628. return $this->licenses[strtolower($identifier)][3];
  48629. }
  48630. public function validate($license)
  48631. {
  48632. if (is_array($license)) {
  48633. $count = count($license);
  48634. if ($count !== count(array_filter($license, 'is_string'))) {
  48635. throw new \InvalidArgumentException('Array of strings expected.');
  48636. }
  48637. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  48638. }
  48639. if (!is_string($license)) {
  48640. throw new \InvalidArgumentException(sprintf(
  48641. 'Array or String expected, %s given.',
  48642. gettype($license)
  48643. ));
  48644. }
  48645. return $this->isValidLicenseString($license);
  48646. }
  48647. public static function getResourcesDir()
  48648. {
  48649. return dirname(__DIR__) . '/res';
  48650. }
  48651. private function loadLicenses()
  48652. {
  48653. if (null !== $this->licenses) {
  48654. return;
  48655. }
  48656. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  48657. $this->licenses = array();
  48658. foreach (json_decode($json, true) as $identifier => $license) {
  48659. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  48660. }
  48661. }
  48662. private function loadExceptions()
  48663. {
  48664. if (null !== $this->exceptions) {
  48665. return;
  48666. }
  48667. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  48668. $this->exceptions = array();
  48669. foreach (json_decode($json, true) as $identifier => $exception) {
  48670. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  48671. }
  48672. }
  48673. private function getLicensesExpression()
  48674. {
  48675. if (null === $this->licensesExpression) {
  48676. $licenses = array_map('preg_quote', array_keys($this->licenses));
  48677. rsort($licenses);
  48678. $licenses = implode('|', $licenses);
  48679. $this->licensesExpression = $licenses;
  48680. }
  48681. return $this->licensesExpression;
  48682. }
  48683. private function getExceptionsExpression()
  48684. {
  48685. if (null === $this->exceptionsExpression) {
  48686. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  48687. rsort($exceptions);
  48688. $exceptions = implode('|', $exceptions);
  48689. $this->exceptionsExpression = $exceptions;
  48690. }
  48691. return $this->exceptionsExpression;
  48692. }
  48693. private function isValidLicenseString($license)
  48694. {
  48695. if (isset($this->licenses[strtolower($license)])) {
  48696. return true;
  48697. }
  48698. $licenses = $this->getLicensesExpression();
  48699. $exceptions = $this->getExceptionsExpression();
  48700. $regex = <<<REGEX
  48701. {
  48702. (?(DEFINE)
  48703. # idstring: 1*( ALPHA / DIGIT / - / . )
  48704. (?<idstring>[\pL\pN.-]{1,})
  48705. # license-id: taken from list
  48706. (?<licenseid>${licenses})
  48707. # license-exception-id: taken from list
  48708. (?<licenseexceptionid>${exceptions})
  48709. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  48710. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  48711. # simple-expresssion: license-id / license-id+ / license-ref
  48712. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  48713. # compound-expression: 1*(
  48714. # simple-expression /
  48715. # simple-expression WITH license-exception-id /
  48716. # compound-expression AND compound-expression /
  48717. # compound-expression OR compound-expression
  48718. # ) / ( compound-expression ) )
  48719. (?<compound_head>
  48720. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  48721. | \( \s* (?&compound_expression) \s* \)
  48722. )
  48723. (?<compound_expression>
  48724. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  48725. )
  48726. # license-expression: 1*1(simple-expression / compound-expression)
  48727. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  48728. ) # end of define
  48729. ^(NONE | NOASSERTION | (?&license_expression))$
  48730. }xi
  48731. REGEX;
  48732. $match = preg_match($regex, $license);
  48733. if (0 === $match) {
  48734. return false;
  48735. }
  48736. if (false === $match) {
  48737. throw new \RuntimeException('Regex failed to compile/run.');
  48738. }
  48739. return true;
  48740. }
  48741. }
  48742. Copyright (C) 2015 Composer
  48743. Permission is hereby granted, free of charge, to any person obtaining a copy of
  48744. this software and associated documentation files (the "Software"), to deal in
  48745. the Software without restriction, including without limitation the rights to
  48746. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  48747. of the Software, and to permit persons to whom the Software is furnished to do
  48748. so, subject to the following conditions:
  48749. The above copyright notice and this permission notice shall be included in all
  48750. copies or substantial portions of the Software.
  48751. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48752. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48753. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48754. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48755. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48756. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  48757. SOFTWARE.
  48758. <?php
  48759. namespace Composer\Semver;
  48760. use Composer\Semver\Constraint\Constraint;
  48761. class Comparator
  48762. {
  48763. public static function greaterThan($version1, $version2)
  48764. {
  48765. return self::compare($version1, '>', $version2);
  48766. }
  48767. public static function greaterThanOrEqualTo($version1, $version2)
  48768. {
  48769. return self::compare($version1, '>=', $version2);
  48770. }
  48771. public static function lessThan($version1, $version2)
  48772. {
  48773. return self::compare($version1, '<', $version2);
  48774. }
  48775. public static function lessThanOrEqualTo($version1, $version2)
  48776. {
  48777. return self::compare($version1, '<=', $version2);
  48778. }
  48779. public static function equalTo($version1, $version2)
  48780. {
  48781. return self::compare($version1, '==', $version2);
  48782. }
  48783. public static function notEqualTo($version1, $version2)
  48784. {
  48785. return self::compare($version1, '!=', $version2);
  48786. }
  48787. public static function compare($version1, $operator, $version2)
  48788. {
  48789. $constraint = new Constraint($operator, $version2);
  48790. return $constraint->matches(new Constraint('==', $version1));
  48791. }
  48792. }
  48793. <?php
  48794. namespace Composer\Semver\Constraint;
  48795. 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);
  48796. abstract class AbstractConstraint implements ConstraintInterface
  48797. {
  48798. protected $prettyString;
  48799. public function matches(ConstraintInterface $provider)
  48800. {
  48801. if ($provider instanceof $this) {
  48802. return $this->matchSpecific($provider);
  48803. }
  48804. return $provider->matches($this);
  48805. }
  48806. public function setPrettyString($prettyString)
  48807. {
  48808. $this->prettyString = $prettyString;
  48809. }
  48810. public function getPrettyString()
  48811. {
  48812. if ($this->prettyString) {
  48813. return $this->prettyString;
  48814. }
  48815. return $this->__toString();
  48816. }
  48817. }
  48818. <?php
  48819. namespace Composer\Semver\Constraint;
  48820. class Constraint implements ConstraintInterface
  48821. {
  48822. const OP_EQ = 0;
  48823. const OP_LT = 1;
  48824. const OP_LE = 2;
  48825. const OP_GT = 3;
  48826. const OP_GE = 4;
  48827. const OP_NE = 5;
  48828. private static $transOpStr = array(
  48829. '=' => self::OP_EQ,
  48830. '==' => self::OP_EQ,
  48831. '<' => self::OP_LT,
  48832. '<=' => self::OP_LE,
  48833. '>' => self::OP_GT,
  48834. '>=' => self::OP_GE,
  48835. '<>' => self::OP_NE,
  48836. '!=' => self::OP_NE,
  48837. );
  48838. private static $transOpInt = array(
  48839. self::OP_EQ => '==',
  48840. self::OP_LT => '<',
  48841. self::OP_LE => '<=',
  48842. self::OP_GT => '>',
  48843. self::OP_GE => '>=',
  48844. self::OP_NE => '!=',
  48845. );
  48846. protected $operator;
  48847. protected $version;
  48848. protected $prettyString;
  48849. public function matches(ConstraintInterface $provider)
  48850. {
  48851. if ($provider instanceof $this) {
  48852. return $this->matchSpecific($provider);
  48853. }
  48854. return $provider->matches($this);
  48855. }
  48856. public function setPrettyString($prettyString)
  48857. {
  48858. $this->prettyString = $prettyString;
  48859. }
  48860. public function getPrettyString()
  48861. {
  48862. if ($this->prettyString) {
  48863. return $this->prettyString;
  48864. }
  48865. return $this->__toString();
  48866. }
  48867. public static function getSupportedOperators()
  48868. {
  48869. return array_keys(self::$transOpStr);
  48870. }
  48871. public function __construct($operator, $version)
  48872. {
  48873. if (!isset(self::$transOpStr[$operator])) {
  48874. throw new \InvalidArgumentException(sprintf(
  48875. 'Invalid operator "%s" given, expected one of: %s',
  48876. $operator,
  48877. implode(', ', self::getSupportedOperators())
  48878. ));
  48879. }
  48880. $this->operator = self::$transOpStr[$operator];
  48881. $this->version = $version;
  48882. }
  48883. public function versionCompare($a, $b, $operator, $compareBranches = false)
  48884. {
  48885. if (!isset(self::$transOpStr[$operator])) {
  48886. throw new \InvalidArgumentException(sprintf(
  48887. 'Invalid operator "%s" given, expected one of: %s',
  48888. $operator,
  48889. implode(', ', self::getSupportedOperators())
  48890. ));
  48891. }
  48892. $aIsBranch = 'dev-' === substr($a, 0, 4);
  48893. $bIsBranch = 'dev-' === substr($b, 0, 4);
  48894. if ($aIsBranch && $bIsBranch) {
  48895. return $operator === '==' && $a === $b;
  48896. }
  48897. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  48898. return false;
  48899. }
  48900. return version_compare($a, $b, $operator);
  48901. }
  48902. public function matchSpecific(Constraint $provider, $compareBranches = false)
  48903. {
  48904. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  48905. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  48906. $isEqualOp = self::OP_EQ === $this->operator;
  48907. $isNonEqualOp = self::OP_NE === $this->operator;
  48908. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  48909. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  48910. if ($isNonEqualOp || $isProviderNonEqualOp) {
  48911. return !$isEqualOp && !$isProviderEqualOp
  48912. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  48913. }
  48914. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  48915. return true;
  48916. }
  48917. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  48918. if ($provider->version === $this->version
  48919. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  48920. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  48921. return false;
  48922. }
  48923. return true;
  48924. }
  48925. return false;
  48926. }
  48927. public function __toString()
  48928. {
  48929. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  48930. }
  48931. }
  48932. <?php
  48933. namespace Composer\Semver\Constraint;
  48934. interface ConstraintInterface
  48935. {
  48936. public function matches(ConstraintInterface $provider);
  48937. public function getPrettyString();
  48938. public function __toString();
  48939. }
  48940. <?php
  48941. namespace Composer\Semver\Constraint;
  48942. class EmptyConstraint implements ConstraintInterface
  48943. {
  48944. protected $prettyString;
  48945. public function matches(ConstraintInterface $provider)
  48946. {
  48947. return true;
  48948. }
  48949. public function setPrettyString($prettyString)
  48950. {
  48951. $this->prettyString = $prettyString;
  48952. }
  48953. public function getPrettyString()
  48954. {
  48955. if ($this->prettyString) {
  48956. return $this->prettyString;
  48957. }
  48958. return $this->__toString();
  48959. }
  48960. public function __toString()
  48961. {
  48962. return '[]';
  48963. }
  48964. }
  48965. <?php
  48966. namespace Composer\Semver\Constraint;
  48967. class MultiConstraint implements ConstraintInterface
  48968. {
  48969. protected $constraints;
  48970. protected $prettyString;
  48971. protected $conjunctive;
  48972. public function __construct(array $constraints, $conjunctive = true)
  48973. {
  48974. $this->constraints = $constraints;
  48975. $this->conjunctive = $conjunctive;
  48976. }
  48977. public function getConstraints()
  48978. {
  48979. return $this->constraints;
  48980. }
  48981. public function isConjunctive()
  48982. {
  48983. return $this->conjunctive;
  48984. }
  48985. public function isDisjunctive()
  48986. {
  48987. return !$this->conjunctive;
  48988. }
  48989. public function matches(ConstraintInterface $provider)
  48990. {
  48991. if (false === $this->conjunctive) {
  48992. foreach ($this->constraints as $constraint) {
  48993. if ($constraint->matches($provider)) {
  48994. return true;
  48995. }
  48996. }
  48997. return false;
  48998. }
  48999. foreach ($this->constraints as $constraint) {
  49000. if (!$constraint->matches($provider)) {
  49001. return false;
  49002. }
  49003. }
  49004. return true;
  49005. }
  49006. public function setPrettyString($prettyString)
  49007. {
  49008. $this->prettyString = $prettyString;
  49009. }
  49010. public function getPrettyString()
  49011. {
  49012. if ($this->prettyString) {
  49013. return $this->prettyString;
  49014. }
  49015. return $this->__toString();
  49016. }
  49017. public function __toString()
  49018. {
  49019. $constraints = array();
  49020. foreach ($this->constraints as $constraint) {
  49021. $constraints[] = (string) $constraint;
  49022. }
  49023. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  49024. }
  49025. }
  49026. <?php
  49027. namespace Composer\Semver;
  49028. use Composer\Semver\Constraint\Constraint;
  49029. class Semver
  49030. {
  49031. const SORT_ASC = 1;
  49032. const SORT_DESC = -1;
  49033. private static $versionParser;
  49034. public static function satisfies($version, $constraints)
  49035. {
  49036. if (null === self::$versionParser) {
  49037. self::$versionParser = new VersionParser();
  49038. }
  49039. $versionParser = self::$versionParser;
  49040. $provider = new Constraint('==', $versionParser->normalize($version));
  49041. $constraints = $versionParser->parseConstraints($constraints);
  49042. return $constraints->matches($provider);
  49043. }
  49044. public static function satisfiedBy(array $versions, $constraints)
  49045. {
  49046. $versions = array_filter($versions, function ($version) use ($constraints) {
  49047. return Semver::satisfies($version, $constraints);
  49048. });
  49049. return array_values($versions);
  49050. }
  49051. public static function sort(array $versions)
  49052. {
  49053. return self::usort($versions, self::SORT_ASC);
  49054. }
  49055. public static function rsort(array $versions)
  49056. {
  49057. return self::usort($versions, self::SORT_DESC);
  49058. }
  49059. private static function usort(array $versions, $direction)
  49060. {
  49061. if (null === self::$versionParser) {
  49062. self::$versionParser = new VersionParser();
  49063. }
  49064. $versionParser = self::$versionParser;
  49065. $normalized = array();
  49066. foreach ($versions as $key => $version) {
  49067. $normalized[] = array($versionParser->normalize($version), $key);
  49068. }
  49069. usort($normalized, function (array $left, array $right) use ($direction) {
  49070. if ($left[0] === $right[0]) {
  49071. return 0;
  49072. }
  49073. if (Comparator::lessThan($left[0], $right[0])) {
  49074. return -$direction;
  49075. }
  49076. return $direction;
  49077. });
  49078. $sorted = array();
  49079. foreach ($normalized as $item) {
  49080. $sorted[] = $versions[$item[1]];
  49081. }
  49082. return $sorted;
  49083. }
  49084. }
  49085. <?php
  49086. namespace Composer\Semver;
  49087. use Composer\Semver\Constraint\ConstraintInterface;
  49088. use Composer\Semver\Constraint\EmptyConstraint;
  49089. use Composer\Semver\Constraint\MultiConstraint;
  49090. use Composer\Semver\Constraint\Constraint;
  49091. class VersionParser
  49092. {
  49093. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  49094. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  49095. public static function parseStability($version)
  49096. {
  49097. $version = preg_replace('{#.+$}i', '', $version);
  49098. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  49099. return 'dev';
  49100. }
  49101. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  49102. if (!empty($match[3])) {
  49103. return 'dev';
  49104. }
  49105. if (!empty($match[1])) {
  49106. if ('beta' === $match[1] || 'b' === $match[1]) {
  49107. return 'beta';
  49108. }
  49109. if ('alpha' === $match[1] || 'a' === $match[1]) {
  49110. return 'alpha';
  49111. }
  49112. if ('rc' === $match[1]) {
  49113. return 'RC';
  49114. }
  49115. }
  49116. return 'stable';
  49117. }
  49118. public static function normalizeStability($stability)
  49119. {
  49120. $stability = strtolower($stability);
  49121. return $stability === 'rc' ? 'RC' : $stability;
  49122. }
  49123. public function normalize($version, $fullVersion = null)
  49124. {
  49125. $version = trim($version);
  49126. if (null === $fullVersion) {
  49127. $fullVersion = $version;
  49128. }
  49129. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  49130. $version = $match[1];
  49131. }
  49132. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  49133. return '9999999-dev';
  49134. }
  49135. if ('dev-' === strtolower(substr($version, 0, 4))) {
  49136. return 'dev-' . substr($version, 4);
  49137. }
  49138. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  49139. $version = $match[1];
  49140. }
  49141. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  49142. $version = $matches[1]
  49143. . (!empty($matches[2]) ? $matches[2] : '.0')
  49144. . (!empty($matches[3]) ? $matches[3] : '.0')
  49145. . (!empty($matches[4]) ? $matches[4] : '.0');
  49146. $index = 5;
  49147. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  49148. $version = preg_replace('{\D}', '.', $matches[1]);
  49149. $index = 2;
  49150. }
  49151. if (isset($index)) {
  49152. if (!empty($matches[$index])) {
  49153. if ('stable' === $matches[$index]) {
  49154. return $version;
  49155. }
  49156. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  49157. }
  49158. if (!empty($matches[$index + 2])) {
  49159. $version .= '-dev';
  49160. }
  49161. return $version;
  49162. }
  49163. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  49164. try {
  49165. return $this->normalizeBranch($match[1]);
  49166. } catch (\Exception $e) {
  49167. }
  49168. }
  49169. $extraMessage = '';
  49170. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  49171. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  49172. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  49173. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  49174. }
  49175. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  49176. }
  49177. public function parseNumericAliasPrefix($branch)
  49178. {
  49179. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  49180. return $matches['version'] . '.';
  49181. }
  49182. return false;
  49183. }
  49184. public function normalizeBranch($name)
  49185. {
  49186. $name = trim($name);
  49187. if (in_array($name, array('master', 'trunk', 'default'))) {
  49188. return $this->normalize($name);
  49189. }
  49190. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  49191. $version = '';
  49192. for ($i = 1; $i < 5; ++$i) {
  49193. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  49194. }
  49195. return str_replace('x', '9999999', $version) . '-dev';
  49196. }
  49197. return 'dev-' . $name;
  49198. }
  49199. public function parseConstraints($constraints)
  49200. {
  49201. $prettyConstraint = $constraints;
  49202. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  49203. $constraints = empty($match[1]) ? '*' : $match[1];
  49204. }
  49205. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  49206. $constraints = $match[1];
  49207. }
  49208. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  49209. $orGroups = array();
  49210. foreach ($orConstraints as $constraints) {
  49211. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  49212. if (count($andConstraints) > 1) {
  49213. $constraintObjects = array();
  49214. foreach ($andConstraints as $constraint) {
  49215. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  49216. $constraintObjects[] = $parsedConstraint;
  49217. }
  49218. }
  49219. } else {
  49220. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  49221. }
  49222. if (1 === count($constraintObjects)) {
  49223. $constraint = $constraintObjects[0];
  49224. } else {
  49225. $constraint = new MultiConstraint($constraintObjects);
  49226. }
  49227. $orGroups[] = $constraint;
  49228. }
  49229. if (1 === count($orGroups)) {
  49230. $constraint = $orGroups[0];
  49231. } elseif (2 === count($orGroups)
  49232. && $orGroups[0] instanceof MultiConstraint
  49233. && $orGroups[1] instanceof MultiConstraint
  49234. && 2 === count($orGroups[0]->getConstraints())
  49235. && 2 === count($orGroups[1]->getConstraints())
  49236. && ($a = (string) $orGroups[0])
  49237. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  49238. && ($b = (string) $orGroups[1])
  49239. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  49240. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  49241. ) {
  49242. $constraint = new MultiConstraint(array(
  49243. new Constraint('>=', substr($a, 4, $posA - 5)),
  49244. new Constraint('<', substr($b, $posB + 2, -1)),
  49245. ));
  49246. } else {
  49247. $constraint = new MultiConstraint($orGroups, false);
  49248. }
  49249. $constraint->setPrettyString($prettyConstraint);
  49250. return $constraint;
  49251. }
  49252. private function parseConstraint($constraint)
  49253. {
  49254. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  49255. $constraint = $match[1];
  49256. if ($match[2] !== 'stable') {
  49257. $stabilityModifier = $match[2];
  49258. }
  49259. }
  49260. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  49261. return array(new EmptyConstraint());
  49262. }
  49263. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  49264. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  49265. if (substr($constraint, 0, 2) === '~>') {
  49266. throw new \UnexpectedValueException(
  49267. 'Could not parse version constraint ' . $constraint . ': ' .
  49268. 'Invalid operator "~>", you probably meant to use the "~" operator'
  49269. );
  49270. }
  49271. if (isset($matches[4]) && '' !== $matches[4]) {
  49272. $position = 4;
  49273. } elseif (isset($matches[3]) && '' !== $matches[3]) {
  49274. $position = 3;
  49275. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  49276. $position = 2;
  49277. } else {
  49278. $position = 1;
  49279. }
  49280. $stabilitySuffix = '';
  49281. if (!empty($matches[5])) {
  49282. $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
  49283. }
  49284. if (!empty($matches[7])) {
  49285. $stabilitySuffix .= '-dev';
  49286. }
  49287. if (!$stabilitySuffix) {
  49288. $stabilitySuffix = '-dev';
  49289. }
  49290. $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix;
  49291. $lowerBound = new Constraint('>=', $lowVersion);
  49292. $highPosition = max(1, $position - 1);
  49293. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  49294. $upperBound = new Constraint('<', $highVersion);
  49295. return array(
  49296. $lowerBound,
  49297. $upperBound,
  49298. );
  49299. }
  49300. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  49301. if ('0' !== $matches[1] || '' === $matches[2]) {
  49302. $position = 1;
  49303. } elseif ('0' !== $matches[2] || '' === $matches[3]) {
  49304. $position = 2;
  49305. } else {
  49306. $position = 3;
  49307. }
  49308. $stabilitySuffix = '';
  49309. if (empty($matches[5]) && empty($matches[7])) {
  49310. $stabilitySuffix .= '-dev';
  49311. }
  49312. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  49313. $lowerBound = new Constraint('>=', $lowVersion);
  49314. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  49315. $upperBound = new Constraint('<', $highVersion);
  49316. return array(
  49317. $lowerBound,
  49318. $upperBound,
  49319. );
  49320. }
  49321. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  49322. if (isset($matches[3]) && '' !== $matches[3]) {
  49323. $position = 3;
  49324. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  49325. $position = 2;
  49326. } else {
  49327. $position = 1;
  49328. }
  49329. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  49330. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  49331. if ($lowVersion === '0.0.0.0-dev') {
  49332. return array(new Constraint('<', $highVersion));
  49333. }
  49334. return array(
  49335. new Constraint('>=', $lowVersion),
  49336. new Constraint('<', $highVersion),
  49337. );
  49338. }
  49339. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  49340. $lowStabilitySuffix = '';
  49341. if (empty($matches[6]) && empty($matches[8])) {
  49342. $lowStabilitySuffix = '-dev';
  49343. }
  49344. $lowVersion = $this->normalize($matches['from']);
  49345. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  49346. $empty = function ($x) {
  49347. return ($x === 0 || $x === '0') ? false : empty($x);
  49348. };
  49349. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  49350. $highVersion = $this->normalize($matches['to']);
  49351. $upperBound = new Constraint('<=', $highVersion);
  49352. } else {
  49353. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  49354. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  49355. $upperBound = new Constraint('<', $highVersion);
  49356. }
  49357. return array(
  49358. $lowerBound,
  49359. $upperBound,
  49360. );
  49361. }
  49362. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  49363. try {
  49364. $version = $this->normalize($matches[2]);
  49365. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  49366. $version .= '-' . $stabilityModifier;
  49367. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  49368. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  49369. if (substr($matches[2], 0, 4) !== 'dev-') {
  49370. $version .= '-dev';
  49371. }
  49372. }
  49373. }
  49374. return array(new Constraint($matches[1] ?: '=', $version));
  49375. } catch (\Exception $e) {
  49376. }
  49377. }
  49378. $message = 'Could not parse version constraint ' . $constraint;
  49379. if (isset($e)) {
  49380. $message .= ': ' . $e->getMessage();
  49381. }
  49382. throw new \UnexpectedValueException($message);
  49383. }
  49384. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  49385. {
  49386. for ($i = 4; $i > 0; --$i) {
  49387. if ($i > $position) {
  49388. $matches[$i] = $pad;
  49389. } elseif ($i === $position && $increment) {
  49390. $matches[$i] += $increment;
  49391. if ($matches[$i] < 0) {
  49392. $matches[$i] = $pad;
  49393. --$position;
  49394. if ($i === 1) {
  49395. return;
  49396. }
  49397. }
  49398. }
  49399. }
  49400. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  49401. }
  49402. private function expandStability($stability)
  49403. {
  49404. $stability = strtolower($stability);
  49405. switch ($stability) {
  49406. case 'a':
  49407. return 'alpha';
  49408. case 'b':
  49409. return 'beta';
  49410. case 'p':
  49411. case 'pl':
  49412. return 'patch';
  49413. case 'rc':
  49414. return 'RC';
  49415. default:
  49416. return $stability;
  49417. }
  49418. }
  49419. }
  49420. Copyright (C) 2016 Composer
  49421. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49422. this software and associated documentation files (the "Software"), to deal in
  49423. the Software without restriction, including without limitation the rights to
  49424. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49425. of the Software, and to permit persons to whom the Software is furnished to do
  49426. so, subject to the following conditions:
  49427. The above copyright notice and this permission notice shall be included in all
  49428. copies or substantial portions of the Software.
  49429. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49430. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49431. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49432. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49433. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49434. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49435. SOFTWARE.
  49436. <?php
  49437. namespace Composer\CaBundle;
  49438. use Psr\Log\LoggerInterface;
  49439. use Symfony\Component\Process\PhpProcess;
  49440. class CaBundle
  49441. {
  49442. private static $caPath;
  49443. private static $caFileValidity = array();
  49444. private static $useOpensslParse;
  49445. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  49446. {
  49447. if (self::$caPath !== null) {
  49448. return self::$caPath;
  49449. }
  49450. $envCertFile = getenv('SSL_CERT_FILE');
  49451. if ($envCertFile && is_readable($envCertFile) && static::validateCaFile($envCertFile, $logger)) {
  49452. return self::$caPath = $envCertFile;
  49453. }
  49454. $envCertDir = getenv('SSL_CERT_DIR');
  49455. if ($envCertDir && is_dir($envCertDir) && is_readable($envCertDir)) {
  49456. return self::$caPath = $envCertDir;
  49457. }
  49458. $configured = ini_get('openssl.cafile');
  49459. if ($configured && strlen($configured) > 0 && is_readable($configured) && static::validateCaFile($configured, $logger)) {
  49460. return self::$caPath = $configured;
  49461. }
  49462. $configured = ini_get('openssl.capath');
  49463. if ($configured && is_dir($configured) && is_readable($configured)) {
  49464. return self::$caPath = $configured;
  49465. }
  49466. $caBundlePaths = array(
  49467. '/etc/pki/tls/certs/ca-bundle.crt',
  49468. '/etc/ssl/certs/ca-certificates.crt',
  49469. '/etc/ssl/ca-bundle.pem',
  49470. '/usr/local/share/certs/ca-root-nss.crt',
  49471. '/usr/ssl/certs/ca-bundle.crt',
  49472. '/opt/local/share/curl/curl-ca-bundle.crt',
  49473. '/usr/local/share/curl/curl-ca-bundle.crt',
  49474. '/usr/share/ssl/certs/ca-bundle.crt',
  49475. '/etc/ssl/cert.pem',
  49476. '/usr/local/etc/ssl/cert.pem',
  49477. '/usr/local/etc/openssl/cert.pem',
  49478. );
  49479. foreach ($caBundlePaths as $caBundle) {
  49480. if (@is_readable($caBundle) && static::validateCaFile($caBundle, $logger)) {
  49481. return self::$caPath = $caBundle;
  49482. }
  49483. }
  49484. foreach ($caBundlePaths as $caBundle) {
  49485. $caBundle = dirname($caBundle);
  49486. if (@is_dir($caBundle) && glob($caBundle.'/*')) {
  49487. return self::$caPath = $caBundle;
  49488. }
  49489. }
  49490. return self::$caPath = static::getBundledCaBundlePath();
  49491. }
  49492. public static function getBundledCaBundlePath()
  49493. {
  49494. $caBundleFile = __DIR__.'/../res/cacert.pem';
  49495. if (0 === strpos($caBundleFile, 'phar://')) {
  49496. file_put_contents(
  49497. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  49498. file_get_contents($caBundleFile)
  49499. );
  49500. register_shutdown_function(function() use ($tempCaBundleFile) {
  49501. @unlink($tempCaBundleFile);
  49502. });
  49503. $caBundleFile = $tempCaBundleFile;
  49504. }
  49505. return $caBundleFile;
  49506. }
  49507. public static function validateCaFile($filename, LoggerInterface $logger = null)
  49508. {
  49509. static $warned = false;
  49510. if (isset(self::$caFileValidity[$filename])) {
  49511. return self::$caFileValidity[$filename];
  49512. }
  49513. $contents = file_get_contents($filename);
  49514. if (!static::isOpensslParseSafe()) {
  49515. if (!$warned && $logger) {
  49516. $logger->warning(sprintf(
  49517. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  49518. PHP_VERSION
  49519. ));
  49520. $warned = true;
  49521. }
  49522. $isValid = !empty($contents);
  49523. } else {
  49524. $isValid = (bool) openssl_x509_parse($contents);
  49525. }
  49526. if ($logger) {
  49527. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  49528. }
  49529. return self::$caFileValidity[$filename] = $isValid;
  49530. }
  49531. public static function isOpensslParseSafe()
  49532. {
  49533. if (null !== self::$useOpensslParse) {
  49534. return self::$useOpensslParse;
  49535. }
  49536. if (PHP_VERSION_ID >= 50600) {
  49537. return self::$useOpensslParse = true;
  49538. }
  49539. if (
  49540. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  49541. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  49542. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  49543. ) {
  49544. return self::$useOpensslParse = true;
  49545. }
  49546. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  49547. return self::$useOpensslParse = false;
  49548. }
  49549. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  49550. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  49551. if (preg_match($regex, PHP_VERSION, $m)) {
  49552. return ((int) $m[1]) >= $fixedVersion;
  49553. }
  49554. return false;
  49555. };
  49556. if (
  49557. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  49558. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  49559. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  49560. ) {
  49561. return self::$useOpensslParse = true;
  49562. }
  49563. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  49564. return self::$useOpensslParse = false;
  49565. }
  49566. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  49567. $script = <<<'EOT'
  49568. error_reporting(-1);
  49569. $info = openssl_x509_parse(base64_decode('%s'));
  49570. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  49571. EOT;
  49572. $script = '<'."?php\n".sprintf($script, $cert);
  49573. try {
  49574. $process = new PhpProcess($script);
  49575. $process->mustRun();
  49576. } catch (\Exception $e) {
  49577. return self::$useOpensslParse = false;
  49578. }
  49579. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  49580. $errorOutput = trim($process->getErrorOutput());
  49581. if (
  49582. count($output) === 3
  49583. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  49584. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  49585. && $output[2] === 'int(-1)'
  49586. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  49587. ) {
  49588. return self::$useOpensslParse = true;
  49589. }
  49590. return self::$useOpensslParse = false;
  49591. }
  49592. public static function reset()
  49593. {
  49594. self::$caFileValidity = array();
  49595. self::$caPath = null;
  49596. self::$useOpensslParse = null;
  49597. }
  49598. }
  49599. Copyright (c) 2012 PHP Framework Interoperability Group
  49600. Permission is hereby granted, free of charge, to any person obtaining a copy
  49601. of this software and associated documentation files (the "Software"), to deal
  49602. in the Software without restriction, including without limitation the rights
  49603. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  49604. copies of the Software, and to permit persons to whom the Software is
  49605. furnished to do so, subject to the following conditions:
  49606. The above copyright notice and this permission notice shall be included in
  49607. all copies or substantial portions of the Software.
  49608. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49609. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49610. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49611. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49612. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49613. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  49614. THE SOFTWARE.
  49615. <?php
  49616. namespace Psr\Log;
  49617. abstract class AbstractLogger implements LoggerInterface
  49618. {
  49619. public function emergency($message, array $context = array())
  49620. {
  49621. $this->log(LogLevel::EMERGENCY, $message, $context);
  49622. }
  49623. public function alert($message, array $context = array())
  49624. {
  49625. $this->log(LogLevel::ALERT, $message, $context);
  49626. }
  49627. public function critical($message, array $context = array())
  49628. {
  49629. $this->log(LogLevel::CRITICAL, $message, $context);
  49630. }
  49631. public function error($message, array $context = array())
  49632. {
  49633. $this->log(LogLevel::ERROR, $message, $context);
  49634. }
  49635. public function warning($message, array $context = array())
  49636. {
  49637. $this->log(LogLevel::WARNING, $message, $context);
  49638. }
  49639. public function notice($message, array $context = array())
  49640. {
  49641. $this->log(LogLevel::NOTICE, $message, $context);
  49642. }
  49643. public function info($message, array $context = array())
  49644. {
  49645. $this->log(LogLevel::INFO, $message, $context);
  49646. }
  49647. public function debug($message, array $context = array())
  49648. {
  49649. $this->log(LogLevel::DEBUG, $message, $context);
  49650. }
  49651. }
  49652. <?php
  49653. namespace Psr\Log;
  49654. class InvalidArgumentException extends \InvalidArgumentException
  49655. {
  49656. }
  49657. <?php
  49658. namespace Psr\Log;
  49659. class LogLevel
  49660. {
  49661. const EMERGENCY = 'emergency';
  49662. const ALERT = 'alert';
  49663. const CRITICAL = 'critical';
  49664. const ERROR = 'error';
  49665. const WARNING = 'warning';
  49666. const NOTICE = 'notice';
  49667. const INFO = 'info';
  49668. const DEBUG = 'debug';
  49669. }
  49670. <?php
  49671. namespace Psr\Log;
  49672. interface LoggerAwareInterface
  49673. {
  49674. public function setLogger(LoggerInterface $logger);
  49675. }
  49676. <?php
  49677. namespace Psr\Log;
  49678. trait LoggerAwareTrait
  49679. {
  49680. protected $logger;
  49681. public function setLogger(LoggerInterface $logger)
  49682. {
  49683. $this->logger = $logger;
  49684. }
  49685. }
  49686. <?php
  49687. namespace Psr\Log;
  49688. interface LoggerInterface
  49689. {
  49690. public function emergency($message, array $context = array());
  49691. public function alert($message, array $context = array());
  49692. public function critical($message, array $context = array());
  49693. public function error($message, array $context = array());
  49694. public function warning($message, array $context = array());
  49695. public function notice($message, array $context = array());
  49696. public function info($message, array $context = array());
  49697. public function debug($message, array $context = array());
  49698. public function log($level, $message, array $context = array());
  49699. }
  49700. <?php
  49701. namespace Psr\Log;
  49702. trait LoggerTrait
  49703. {
  49704. public function emergency($message, array $context = array())
  49705. {
  49706. $this->log(LogLevel::EMERGENCY, $message, $context);
  49707. }
  49708. public function alert($message, array $context = array())
  49709. {
  49710. $this->log(LogLevel::ALERT, $message, $context);
  49711. }
  49712. public function critical($message, array $context = array())
  49713. {
  49714. $this->log(LogLevel::CRITICAL, $message, $context);
  49715. }
  49716. public function error($message, array $context = array())
  49717. {
  49718. $this->log(LogLevel::ERROR, $message, $context);
  49719. }
  49720. public function warning($message, array $context = array())
  49721. {
  49722. $this->log(LogLevel::WARNING, $message, $context);
  49723. }
  49724. public function notice($message, array $context = array())
  49725. {
  49726. $this->log(LogLevel::NOTICE, $message, $context);
  49727. }
  49728. public function info($message, array $context = array())
  49729. {
  49730. $this->log(LogLevel::INFO, $message, $context);
  49731. }
  49732. public function debug($message, array $context = array())
  49733. {
  49734. $this->log(LogLevel::DEBUG, $message, $context);
  49735. }
  49736. abstract public function log($level, $message, array $context = array());
  49737. }
  49738. <?php
  49739. namespace Psr\Log;
  49740. class NullLogger extends AbstractLogger
  49741. {
  49742. public function log($level, $message, array $context = array())
  49743. {
  49744. }
  49745. }
  49746. <?php
  49747. namespace Psr\Log\Test;
  49748. use Psr\Log\LoggerInterface;
  49749. use Psr\Log\LogLevel;
  49750. abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
  49751. {
  49752. abstract public function getLogger();
  49753. abstract public function getLogs();
  49754. public function testImplements()
  49755. {
  49756. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  49757. }
  49758. public function testLogsAtAllLevels($level, $message)
  49759. {
  49760. $logger = $this->getLogger();
  49761. $logger->{$level}($message, array('user' => 'Bob'));
  49762. $logger->log($level, $message, array('user' => 'Bob'));
  49763. $expected = array(
  49764. $level.' message of level '.$level.' with context: Bob',
  49765. $level.' message of level '.$level.' with context: Bob',
  49766. );
  49767. $this->assertEquals($expected, $this->getLogs());
  49768. }
  49769. public function provideLevelsAndMessages()
  49770. {
  49771. return array(
  49772. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  49773. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  49774. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  49775. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  49776. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  49777. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  49778. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  49779. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  49780. );
  49781. }
  49782. public function testThrowsOnInvalidLevel()
  49783. {
  49784. $logger = $this->getLogger();
  49785. $logger->log('invalid level', 'Foo');
  49786. }
  49787. public function testContextReplacement()
  49788. {
  49789. $logger = $this->getLogger();
  49790. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  49791. $expected = array('info {Message {nothing} Bob Bar a}');
  49792. $this->assertEquals($expected, $this->getLogs());
  49793. }
  49794. public function testObjectCastToString()
  49795. {
  49796. if (method_exists($this, 'createPartialMock')) {
  49797. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  49798. } else {
  49799. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  49800. }
  49801. $dummy->expects($this->once())
  49802. ->method('__toString')
  49803. ->will($this->returnValue('DUMMY'));
  49804. $this->getLogger()->warning($dummy);
  49805. $expected = array('warning DUMMY');
  49806. $this->assertEquals($expected, $this->getLogs());
  49807. }
  49808. public function testContextCanContainAnything()
  49809. {
  49810. $context = array(
  49811. 'bool' => true,
  49812. 'null' => null,
  49813. 'string' => 'Foo',
  49814. 'int' => 0,
  49815. 'float' => 0.5,
  49816. 'nested' => array('with object' => new DummyTest),
  49817. 'object' => new \DateTime,
  49818. 'resource' => fopen('php://memory', 'r'),
  49819. );
  49820. $this->getLogger()->warning('Crazy context data', $context);
  49821. $expected = array('warning Crazy context data');
  49822. $this->assertEquals($expected, $this->getLogs());
  49823. }
  49824. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  49825. {
  49826. $logger = $this->getLogger();
  49827. $logger->warning('Random message', array('exception' => 'oops'));
  49828. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  49829. $expected = array(
  49830. 'warning Random message',
  49831. 'critical Uncaught Exception!'
  49832. );
  49833. $this->assertEquals($expected, $this->getLogs());
  49834. }
  49835. }
  49836. class DummyTest
  49837. {
  49838. public function __toString()
  49839. {
  49840. }
  49841. }
  49842. <?php
  49843. require_once __DIR__ . '/composer/autoload_real.php';
  49844. return ComposerAutoloaderInitComposerPhar1520289262::getLoader();
  49845. <?php
  49846. $vendorDir = dirname(dirname(__FILE__));
  49847. $baseDir = dirname($vendorDir);
  49848. return array(
  49849. );
  49850. <?php
  49851. $vendorDir = dirname(dirname(__FILE__));
  49852. $baseDir = dirname($vendorDir);
  49853. return array(
  49854. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  49855. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  49856. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  49857. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  49858. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  49859. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  49860. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  49861. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  49862. 'Seld\\CliPrompt\\' => array($vendorDir . '/seld/cli-prompt/src'),
  49863. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  49864. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  49865. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  49866. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  49867. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  49868. 'Composer\\' => array($baseDir . '/src/Composer'),
  49869. );
  49870. <?php
  49871. $vendorDir = dirname(dirname(__FILE__));
  49872. $baseDir = dirname($vendorDir);
  49873. return array(
  49874. );
  49875. <?php
  49876. $vendorDir = dirname(dirname(__FILE__));
  49877. $baseDir = dirname($vendorDir);
  49878. return array(
  49879. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  49880. );
  49881. <?php
  49882. class ComposerAutoloaderInitComposerPhar1520289262
  49883. {
  49884. private static $loader;
  49885. public static function loadClassLoader($class)
  49886. {
  49887. if ('Composer\Autoload\ClassLoader' === $class) {
  49888. require __DIR__ . '/ClassLoader.php';
  49889. }
  49890. }
  49891. public static function getLoader()
  49892. {
  49893. if (null !== self::$loader) {
  49894. return self::$loader;
  49895. }
  49896. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1520289262', 'loadClassLoader'), true, true);
  49897. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  49898. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1520289262', 'loadClassLoader'));
  49899. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  49900. if ($useStaticLoader) {
  49901. require_once __DIR__ . '/autoload_static.php';
  49902. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1520289262::getInitializer($loader));
  49903. } else {
  49904. $map = require __DIR__ . '/autoload_namespaces.php';
  49905. foreach ($map as $namespace => $path) {
  49906. $loader->set($namespace, $path);
  49907. }
  49908. $map = require __DIR__ . '/autoload_psr4.php';
  49909. foreach ($map as $namespace => $path) {
  49910. $loader->setPsr4($namespace, $path);
  49911. }
  49912. $classMap = require __DIR__ . '/autoload_classmap.php';
  49913. if ($classMap) {
  49914. $loader->addClassMap($classMap);
  49915. }
  49916. }
  49917. $loader->register(true);
  49918. if ($useStaticLoader) {
  49919. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1520289262::$files;
  49920. } else {
  49921. $includeFiles = require __DIR__ . '/autoload_files.php';
  49922. }
  49923. foreach ($includeFiles as $fileIdentifier => $file) {
  49924. composerRequireComposerPhar1520289262($fileIdentifier, $file);
  49925. }
  49926. return $loader;
  49927. }
  49928. }
  49929. function composerRequireComposerPhar1520289262($fileIdentifier, $file)
  49930. {
  49931. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  49932. require $file;
  49933. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  49934. }
  49935. }
  49936. <?php
  49937. namespace Composer\Autoload;
  49938. class ComposerStaticInitComposerPhar1520289262
  49939. {
  49940. public static $files = array (
  49941. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  49942. );
  49943. public static $prefixLengthsPsr4 = array (
  49944. 'S' =>
  49945. array (
  49946. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  49947. 'Symfony\\Component\\Process\\' => 26,
  49948. 'Symfony\\Component\\Finder\\' => 25,
  49949. 'Symfony\\Component\\Filesystem\\' => 29,
  49950. 'Symfony\\Component\\Debug\\' => 24,
  49951. 'Symfony\\Component\\Console\\' => 26,
  49952. 'Seld\\PharUtils\\' => 15,
  49953. 'Seld\\JsonLint\\' => 14,
  49954. 'Seld\\CliPrompt\\' => 15,
  49955. ),
  49956. 'P' =>
  49957. array (
  49958. 'Psr\\Log\\' => 8,
  49959. ),
  49960. 'J' =>
  49961. array (
  49962. 'JsonSchema\\' => 11,
  49963. ),
  49964. 'C' =>
  49965. array (
  49966. 'Composer\\Spdx\\' => 14,
  49967. 'Composer\\Semver\\' => 16,
  49968. 'Composer\\CaBundle\\' => 18,
  49969. 'Composer\\' => 9,
  49970. ),
  49971. );
  49972. public static $prefixDirsPsr4 = array (
  49973. 'Symfony\\Polyfill\\Mbstring\\' =>
  49974. array (
  49975. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  49976. ),
  49977. 'Symfony\\Component\\Process\\' =>
  49978. array (
  49979. 0 => __DIR__ . '/..' . '/symfony/process',
  49980. ),
  49981. 'Symfony\\Component\\Finder\\' =>
  49982. array (
  49983. 0 => __DIR__ . '/..' . '/symfony/finder',
  49984. ),
  49985. 'Symfony\\Component\\Filesystem\\' =>
  49986. array (
  49987. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  49988. ),
  49989. 'Symfony\\Component\\Debug\\' =>
  49990. array (
  49991. 0 => __DIR__ . '/..' . '/symfony/debug',
  49992. ),
  49993. 'Symfony\\Component\\Console\\' =>
  49994. array (
  49995. 0 => __DIR__ . '/..' . '/symfony/console',
  49996. ),
  49997. 'Seld\\PharUtils\\' =>
  49998. array (
  49999. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  50000. ),
  50001. 'Seld\\JsonLint\\' =>
  50002. array (
  50003. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  50004. ),
  50005. 'Seld\\CliPrompt\\' =>
  50006. array (
  50007. 0 => __DIR__ . '/..' . '/seld/cli-prompt/src',
  50008. ),
  50009. 'Psr\\Log\\' =>
  50010. array (
  50011. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  50012. ),
  50013. 'JsonSchema\\' =>
  50014. array (
  50015. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  50016. ),
  50017. 'Composer\\Spdx\\' =>
  50018. array (
  50019. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  50020. ),
  50021. 'Composer\\Semver\\' =>
  50022. array (
  50023. 0 => __DIR__ . '/..' . '/composer/semver/src',
  50024. ),
  50025. 'Composer\\CaBundle\\' =>
  50026. array (
  50027. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  50028. ),
  50029. 'Composer\\' =>
  50030. array (
  50031. 0 => __DIR__ . '/../..' . '/src/Composer',
  50032. ),
  50033. );
  50034. public static function getInitializer(ClassLoader $loader)
  50035. {
  50036. return \Closure::bind(function () use ($loader) {
  50037. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1520289262::$prefixLengthsPsr4;
  50038. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1520289262::$prefixDirsPsr4;
  50039. }, null, ClassLoader::class);
  50040. }
  50041. }
  50042. <?php
  50043. namespace Composer\Autoload;
  50044. class ClassLoader
  50045. {
  50046. private $prefixLengthsPsr4 = array();
  50047. private $prefixDirsPsr4 = array();
  50048. private $fallbackDirsPsr4 = array();
  50049. private $prefixesPsr0 = array();
  50050. private $fallbackDirsPsr0 = array();
  50051. private $useIncludePath = false;
  50052. private $classMap = array();
  50053. private $classMapAuthoritative = false;
  50054. private $missingClasses = array();
  50055. private $apcuPrefix;
  50056. public function getPrefixes()
  50057. {
  50058. if (!empty($this->prefixesPsr0)) {
  50059. return call_user_func_array('array_merge', $this->prefixesPsr0);
  50060. }
  50061. return array();
  50062. }
  50063. public function getPrefixesPsr4()
  50064. {
  50065. return $this->prefixDirsPsr4;
  50066. }
  50067. public function getFallbackDirs()
  50068. {
  50069. return $this->fallbackDirsPsr0;
  50070. }
  50071. public function getFallbackDirsPsr4()
  50072. {
  50073. return $this->fallbackDirsPsr4;
  50074. }
  50075. public function getClassMap()
  50076. {
  50077. return $this->classMap;
  50078. }
  50079. public function addClassMap(array $classMap)
  50080. {
  50081. if ($this->classMap) {
  50082. $this->classMap = array_merge($this->classMap, $classMap);
  50083. } else {
  50084. $this->classMap = $classMap;
  50085. }
  50086. }
  50087. public function add($prefix, $paths, $prepend = false)
  50088. {
  50089. if (!$prefix) {
  50090. if ($prepend) {
  50091. $this->fallbackDirsPsr0 = array_merge(
  50092. (array) $paths,
  50093. $this->fallbackDirsPsr0
  50094. );
  50095. } else {
  50096. $this->fallbackDirsPsr0 = array_merge(
  50097. $this->fallbackDirsPsr0,
  50098. (array) $paths
  50099. );
  50100. }
  50101. return;
  50102. }
  50103. $first = $prefix[0];
  50104. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  50105. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  50106. return;
  50107. }
  50108. if ($prepend) {
  50109. $this->prefixesPsr0[$first][$prefix] = array_merge(
  50110. (array) $paths,
  50111. $this->prefixesPsr0[$first][$prefix]
  50112. );
  50113. } else {
  50114. $this->prefixesPsr0[$first][$prefix] = array_merge(
  50115. $this->prefixesPsr0[$first][$prefix],
  50116. (array) $paths
  50117. );
  50118. }
  50119. }
  50120. public function addPsr4($prefix, $paths, $prepend = false)
  50121. {
  50122. if (!$prefix) {
  50123. if ($prepend) {
  50124. $this->fallbackDirsPsr4 = array_merge(
  50125. (array) $paths,
  50126. $this->fallbackDirsPsr4
  50127. );
  50128. } else {
  50129. $this->fallbackDirsPsr4 = array_merge(
  50130. $this->fallbackDirsPsr4,
  50131. (array) $paths
  50132. );
  50133. }
  50134. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  50135. $length = strlen($prefix);
  50136. if ('\\' !== $prefix[$length - 1]) {
  50137. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  50138. }
  50139. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  50140. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  50141. } elseif ($prepend) {
  50142. $this->prefixDirsPsr4[$prefix] = array_merge(
  50143. (array) $paths,
  50144. $this->prefixDirsPsr4[$prefix]
  50145. );
  50146. } else {
  50147. $this->prefixDirsPsr4[$prefix] = array_merge(
  50148. $this->prefixDirsPsr4[$prefix],
  50149. (array) $paths
  50150. );
  50151. }
  50152. }
  50153. public function set($prefix, $paths)
  50154. {
  50155. if (!$prefix) {
  50156. $this->fallbackDirsPsr0 = (array) $paths;
  50157. } else {
  50158. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  50159. }
  50160. }
  50161. public function setPsr4($prefix, $paths)
  50162. {
  50163. if (!$prefix) {
  50164. $this->fallbackDirsPsr4 = (array) $paths;
  50165. } else {
  50166. $length = strlen($prefix);
  50167. if ('\\' !== $prefix[$length - 1]) {
  50168. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  50169. }
  50170. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  50171. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  50172. }
  50173. }
  50174. public function setUseIncludePath($useIncludePath)
  50175. {
  50176. $this->useIncludePath = $useIncludePath;
  50177. }
  50178. public function getUseIncludePath()
  50179. {
  50180. return $this->useIncludePath;
  50181. }
  50182. public function setClassMapAuthoritative($classMapAuthoritative)
  50183. {
  50184. $this->classMapAuthoritative = $classMapAuthoritative;
  50185. }
  50186. public function isClassMapAuthoritative()
  50187. {
  50188. return $this->classMapAuthoritative;
  50189. }
  50190. public function setApcuPrefix($apcuPrefix)
  50191. {
  50192. $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
  50193. }
  50194. public function getApcuPrefix()
  50195. {
  50196. return $this->apcuPrefix;
  50197. }
  50198. public function register($prepend = false)
  50199. {
  50200. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  50201. }
  50202. public function unregister()
  50203. {
  50204. spl_autoload_unregister(array($this, 'loadClass'));
  50205. }
  50206. public function loadClass($class)
  50207. {
  50208. if ($file = $this->findFile($class)) {
  50209. includeFile($file);
  50210. return true;
  50211. }
  50212. }
  50213. public function findFile($class)
  50214. {
  50215. if (isset($this->classMap[$class])) {
  50216. return $this->classMap[$class];
  50217. }
  50218. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  50219. return false;
  50220. }
  50221. if (null !== $this->apcuPrefix) {
  50222. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  50223. if ($hit) {
  50224. return $file;
  50225. }
  50226. }
  50227. $file = $this->findFileWithExtension($class, '.php');
  50228. if (false === $file && defined('HHVM_VERSION')) {
  50229. $file = $this->findFileWithExtension($class, '.hh');
  50230. }
  50231. if (null !== $this->apcuPrefix) {
  50232. apcu_add($this->apcuPrefix.$class, $file);
  50233. }
  50234. if (false === $file) {
  50235. $this->missingClasses[$class] = true;
  50236. }
  50237. return $file;
  50238. }
  50239. private function findFileWithExtension($class, $ext)
  50240. {
  50241. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  50242. $first = $class[0];
  50243. if (isset($this->prefixLengthsPsr4[$first])) {
  50244. $subPath = $class;
  50245. while (false !== $lastPos = strrpos($subPath, '\\')) {
  50246. $subPath = substr($subPath, 0, $lastPos);
  50247. $search = $subPath.'\\';
  50248. if (isset($this->prefixDirsPsr4[$search])) {
  50249. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  50250. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  50251. if (file_exists($file = $dir . $pathEnd)) {
  50252. return $file;
  50253. }
  50254. }
  50255. }
  50256. }
  50257. }
  50258. foreach ($this->fallbackDirsPsr4 as $dir) {
  50259. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  50260. return $file;
  50261. }
  50262. }
  50263. if (false !== $pos = strrpos($class, '\\')) {
  50264. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  50265. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  50266. } else {
  50267. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  50268. }
  50269. if (isset($this->prefixesPsr0[$first])) {
  50270. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  50271. if (0 === strpos($class, $prefix)) {
  50272. foreach ($dirs as $dir) {
  50273. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  50274. return $file;
  50275. }
  50276. }
  50277. }
  50278. }
  50279. }
  50280. foreach ($this->fallbackDirsPsr0 as $dir) {
  50281. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  50282. return $file;
  50283. }
  50284. }
  50285. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  50286. return $file;
  50287. }
  50288. return false;
  50289. }
  50290. }
  50291. function includeFile($file)
  50292. {
  50293. include $file;
  50294. }
  50295. ##
  50296. ## Bundle of CA Root Certificates
  50297. ##
  50298. ## Certificate data from Mozilla as of: Wed Sep 20 03:12:05 2017 GMT
  50299. ##
  50300. ## This is a bundle of X.509 certificates of public Certificate Authorities
  50301. ## (CA). These were automatically extracted from Mozilla's root certificates
  50302. ## file (certdata.txt). This file can be found in the mozilla source tree:
  50303. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  50304. ##
  50305. ## It contains the certificates in PEM format and therefore
  50306. ## can be directly used with curl / libcurl / php_curl, or with
  50307. ## an Apache+mod_ssl webserver for SSL client authentication.
  50308. ## Just configure this file as the SSLCACertificateFile.
  50309. ##
  50310. ## Conversion done with mk-ca-bundle.pl version 1.27.
  50311. ## SHA256: 2b2dbe5244e0047e088c597998883a913f6c5fffd1cb5c0fe5a368c8466cb2ec
  50312. ##
  50313. GlobalSign Root CA
  50314. ==================
  50315. -----BEGIN CERTIFICATE-----
  50316. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  50317. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  50318. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  50319. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  50320. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  50321. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  50322. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  50323. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  50324. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  50325. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  50326. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  50327. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  50328. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  50329. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  50330. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  50331. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  50332. -----END CERTIFICATE-----
  50333. GlobalSign Root CA - R2
  50334. =======================
  50335. -----BEGIN CERTIFICATE-----
  50336. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  50337. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  50338. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  50339. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  50340. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  50341. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  50342. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  50343. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  50344. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  50345. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  50346. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  50347. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  50348. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  50349. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  50350. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  50351. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  50352. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  50353. -----END CERTIFICATE-----
  50354. Verisign Class 3 Public Primary Certification Authority - G3
  50355. ============================================================
  50356. -----BEGIN CERTIFICATE-----
  50357. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  50358. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  50359. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  50360. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  50361. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  50362. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  50363. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  50364. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  50365. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  50366. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  50367. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  50368. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  50369. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  50370. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  50371. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  50372. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  50373. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  50374. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  50375. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  50376. -----END CERTIFICATE-----
  50377. Entrust.net Premium 2048 Secure Server CA
  50378. =========================================
  50379. -----BEGIN CERTIFICATE-----
  50380. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  50381. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  50382. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  50383. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  50384. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  50385. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  50386. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  50387. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  50388. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  50389. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  50390. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  50391. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  50392. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  50393. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  50394. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  50395. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  50396. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  50397. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  50398. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  50399. -----END CERTIFICATE-----
  50400. Baltimore CyberTrust Root
  50401. =========================
  50402. -----BEGIN CERTIFICATE-----
  50403. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  50404. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  50405. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  50406. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  50407. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  50408. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  50409. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  50410. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  50411. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  50412. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  50413. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  50414. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  50415. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  50416. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  50417. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  50418. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  50419. -----END CERTIFICATE-----
  50420. AddTrust External Root
  50421. ======================
  50422. -----BEGIN CERTIFICATE-----
  50423. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  50424. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  50425. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  50426. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  50427. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  50428. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  50429. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  50430. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  50431. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  50432. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  50433. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  50434. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  50435. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  50436. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  50437. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  50438. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  50439. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  50440. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  50441. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  50442. -----END CERTIFICATE-----
  50443. Entrust Root Certification Authority
  50444. ====================================
  50445. -----BEGIN CERTIFICATE-----
  50446. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  50447. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  50448. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  50449. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  50450. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  50451. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  50452. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  50453. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  50454. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  50455. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  50456. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  50457. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  50458. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  50459. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  50460. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  50461. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  50462. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  50463. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  50464. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  50465. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  50466. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  50467. -----END CERTIFICATE-----
  50468. GeoTrust Global CA
  50469. ==================
  50470. -----BEGIN CERTIFICATE-----
  50471. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  50472. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  50473. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  50474. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  50475. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  50476. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  50477. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  50478. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  50479. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  50480. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  50481. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  50482. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  50483. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  50484. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  50485. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  50486. Mw==
  50487. -----END CERTIFICATE-----
  50488. GeoTrust Universal CA
  50489. =====================
  50490. -----BEGIN CERTIFICATE-----
  50491. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  50492. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  50493. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  50494. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  50495. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  50496. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  50497. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  50498. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  50499. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  50500. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  50501. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  50502. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  50503. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  50504. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  50505. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  50506. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  50507. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  50508. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  50509. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  50510. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  50511. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  50512. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  50513. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  50514. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  50515. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  50516. -----END CERTIFICATE-----
  50517. GeoTrust Universal CA 2
  50518. =======================
  50519. -----BEGIN CERTIFICATE-----
  50520. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  50521. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  50522. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  50523. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  50524. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  50525. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  50526. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  50527. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  50528. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  50529. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  50530. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  50531. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  50532. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  50533. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  50534. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  50535. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  50536. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  50537. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  50538. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  50539. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  50540. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  50541. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  50542. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  50543. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  50544. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  50545. -----END CERTIFICATE-----
  50546. Visa eCommerce Root
  50547. ===================
  50548. -----BEGIN CERTIFICATE-----
  50549. MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG
  50550. EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug
  50551. QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2
  50552. WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm
  50553. VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv
  50554. bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL
  50555. F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b
  50556. RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0
  50557. TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI
  50558. /k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs
  50559. GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG
  50560. MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc
  50561. CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW
  50562. YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz
  50563. zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu
  50564. YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
  50565. 398znM/jra6O1I7mT1GvFpLgXPYHDw==
  50566. -----END CERTIFICATE-----
  50567. Certum Root CA
  50568. ==============
  50569. -----BEGIN CERTIFICATE-----
  50570. MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQK
  50571. ExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQTAeFw0wMjA2MTExMDQ2Mzla
  50572. Fw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8u
  50573. by4xEjAQBgNVBAMTCUNlcnR1bSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6x
  50574. wS7TT3zNJc4YPk/EjG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdL
  50575. kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ
  50576. 89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K
  50577. Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P
  50578. NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq
  50579. hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+
  50580. GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg
  50581. GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/
  50582. 0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS
  50583. qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw==
  50584. -----END CERTIFICATE-----
  50585. Comodo AAA Services root
  50586. ========================
  50587. -----BEGIN CERTIFICATE-----
  50588. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  50589. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  50590. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  50591. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  50592. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  50593. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  50594. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  50595. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  50596. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  50597. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  50598. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  50599. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  50600. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  50601. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  50602. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  50603. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  50604. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  50605. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  50606. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  50607. -----END CERTIFICATE-----
  50608. QuoVadis Root CA
  50609. ================
  50610. -----BEGIN CERTIFICATE-----
  50611. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  50612. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  50613. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  50614. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  50615. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  50616. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  50617. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  50618. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  50619. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  50620. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  50621. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  50622. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  50623. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  50624. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  50625. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  50626. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  50627. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  50628. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  50629. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  50630. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  50631. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  50632. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  50633. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  50634. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  50635. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  50636. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  50637. 5nrQNiOKSnQ2+Q==
  50638. -----END CERTIFICATE-----
  50639. QuoVadis Root CA 2
  50640. ==================
  50641. -----BEGIN CERTIFICATE-----
  50642. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  50643. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  50644. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  50645. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  50646. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  50647. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  50648. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  50649. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  50650. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  50651. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  50652. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  50653. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  50654. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  50655. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  50656. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  50657. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  50658. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  50659. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  50660. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  50661. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  50662. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  50663. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  50664. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  50665. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  50666. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  50667. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  50668. -----END CERTIFICATE-----
  50669. QuoVadis Root CA 3
  50670. ==================
  50671. -----BEGIN CERTIFICATE-----
  50672. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  50673. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  50674. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  50675. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  50676. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  50677. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  50678. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  50679. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  50680. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  50681. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  50682. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  50683. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  50684. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  50685. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  50686. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  50687. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  50688. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  50689. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  50690. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  50691. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  50692. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  50693. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  50694. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  50695. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  50696. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  50697. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  50698. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  50699. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  50700. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  50701. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  50702. -----END CERTIFICATE-----
  50703. Security Communication Root CA
  50704. ==============================
  50705. -----BEGIN CERTIFICATE-----
  50706. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  50707. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  50708. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  50709. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  50710. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  50711. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  50712. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  50713. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  50714. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  50715. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  50716. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  50717. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  50718. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  50719. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  50720. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  50721. FL39vmwLAw==
  50722. -----END CERTIFICATE-----
  50723. Sonera Class 2 Root CA
  50724. ======================
  50725. -----BEGIN CERTIFICATE-----
  50726. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  50727. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  50728. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  50729. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  50730. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  50731. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  50732. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  50733. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  50734. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  50735. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  50736. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  50737. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  50738. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  50739. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  50740. llpwrN9M
  50741. -----END CERTIFICATE-----
  50742. Camerfirma Chambers of Commerce Root
  50743. ====================================
  50744. -----BEGIN CERTIFICATE-----
  50745. MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
  50746. QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
  50747. ZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAx
  50748. NjEzNDNaFw0zNzA5MzAxNjEzNDRaMH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZp
  50749. cm1hIFNBIENJRiBBODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3Jn
  50750. MSIwIAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0BAQEFAAOC
  50751. AQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtbunXF/KGIJPov7coISjlU
  50752. xFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0dBmpAPrMMhe5cG3nCYsS4No41XQEMIwRH
  50753. NaqbYE6gZj3LJgqcQKH0XZi/caulAGgq7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jW
  50754. DA+wWFjbw2Y3npuRVDM30pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFV
  50755. d9oKDMyXroDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIGA1Ud
  50756. EwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5jaGFtYmVyc2lnbi5v
  50757. cmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p26EpW1eLTXYGduHRooowDgYDVR0P
  50758. AQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hh
  50759. bWJlcnNpZ24ub3JnMCcGA1UdEgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYD
  50760. VR0gBFEwTzBNBgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz
  50761. aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi
  50762. fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD
  50763. L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN
  50764. UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n
  50765. ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1
  50766. erfutGWaIZDgqtCYvDi1czyL+Nw=
  50767. -----END CERTIFICATE-----
  50768. Camerfirma Global Chambersign Root
  50769. ==================================
  50770. -----BEGIN CERTIFICATE-----
  50771. MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
  50772. QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
  50773. ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx
  50774. NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt
  50775. YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg
  50776. MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw
  50777. ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J
  50778. 1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8O
  50779. by4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpVeAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl
  50780. 6DJWk0aJqCWKZQbua795B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c
  50781. 8lCrEqWhz0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0TAQH/
  50782. BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1iZXJzaWduLm9yZy9j
  50783. aGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4wTcbOX60Qq+UDpfqpFDAOBgNVHQ8B
  50784. Af8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAHMCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBj
  50785. aGFtYmVyc2lnbi5vcmcwKgYDVR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9y
  50786. ZzBbBgNVHSAEVDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh
  50787. bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0BAQUFAAOCAQEA
  50788. PDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUMbKGKfKX0j//U2K0X1S0E0T9Y
  50789. gOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXiryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJ
  50790. PJ7oKXqJ1/6v/2j1pReQvayZzKWGVwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4
  50791. IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes
  50792. t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A==
  50793. -----END CERTIFICATE-----
  50794. XRamp Global CA Root
  50795. ====================
  50796. -----BEGIN CERTIFICATE-----
  50797. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  50798. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  50799. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  50800. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  50801. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  50802. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  50803. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  50804. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  50805. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  50806. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  50807. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  50808. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  50809. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  50810. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  50811. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  50812. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  50813. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  50814. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  50815. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  50816. -----END CERTIFICATE-----
  50817. Go Daddy Class 2 CA
  50818. ===================
  50819. -----BEGIN CERTIFICATE-----
  50820. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  50821. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  50822. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  50823. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  50824. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  50825. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  50826. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  50827. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  50828. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  50829. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  50830. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  50831. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  50832. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  50833. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  50834. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  50835. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  50836. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  50837. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  50838. vZ8=
  50839. -----END CERTIFICATE-----
  50840. Starfield Class 2 CA
  50841. ====================
  50842. -----BEGIN CERTIFICATE-----
  50843. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  50844. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  50845. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  50846. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  50847. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  50848. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  50849. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  50850. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  50851. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  50852. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  50853. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  50854. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  50855. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  50856. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  50857. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  50858. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  50859. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  50860. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  50861. QBFGmh95DmK/D5fs4C8fF5Q=
  50862. -----END CERTIFICATE-----
  50863. StartCom Certification Authority
  50864. ================================
  50865. -----BEGIN CERTIFICATE-----
  50866. MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  50867. U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
  50868. ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
  50869. NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
  50870. LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
  50871. U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
  50872. ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
  50873. o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
  50874. Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
  50875. eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
  50876. 2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
  50877. 6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
  50878. osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
  50879. untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
  50880. UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
  50881. 37uMdBNSSwIDAQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE
  50882. FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9jZXJ0LnN0YXJ0
  50883. Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3JsLnN0YXJ0Y29tLm9yZy9zZnNj
  50884. YS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFMBgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUH
  50885. AgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRw
  50886. Oi8vY2VydC5zdGFydGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYg
  50887. U3RhcnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlhYmlsaXR5
  50888. LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2YgdGhlIFN0YXJ0Q29tIENl
  50889. cnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFpbGFibGUgYXQgaHR0cDovL2NlcnQuc3Rh
  50890. cnRjb20ub3JnL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilT
  50891. dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC
  50892. AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh
  50893. 3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm
  50894. vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk
  50895. fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3
  50896. fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ
  50897. EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
  50898. yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl
  50899. 1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/
  50900. lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro
  50901. g14=
  50902. -----END CERTIFICATE-----
  50903. Taiwan GRCA
  50904. ===========
  50905. -----BEGIN CERTIFICATE-----
  50906. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  50907. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  50908. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  50909. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  50910. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  50911. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  50912. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  50913. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  50914. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  50915. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  50916. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  50917. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  50918. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  50919. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  50920. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  50921. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  50922. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  50923. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  50924. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  50925. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  50926. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  50927. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  50928. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  50929. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  50930. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  50931. -----END CERTIFICATE-----
  50932. DigiCert Assured ID Root CA
  50933. ===========================
  50934. -----BEGIN CERTIFICATE-----
  50935. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  50936. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  50937. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  50938. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  50939. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  50940. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  50941. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  50942. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  50943. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  50944. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  50945. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  50946. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  50947. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  50948. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  50949. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  50950. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  50951. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  50952. -----END CERTIFICATE-----
  50953. DigiCert Global Root CA
  50954. =======================
  50955. -----BEGIN CERTIFICATE-----
  50956. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  50957. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  50958. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  50959. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  50960. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  50961. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  50962. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  50963. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  50964. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  50965. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  50966. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  50967. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  50968. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  50969. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  50970. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  50971. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  50972. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  50973. -----END CERTIFICATE-----
  50974. DigiCert High Assurance EV Root CA
  50975. ==================================
  50976. -----BEGIN CERTIFICATE-----
  50977. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  50978. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  50979. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  50980. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  50981. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  50982. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  50983. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  50984. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  50985. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  50986. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  50987. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  50988. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  50989. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  50990. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  50991. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  50992. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  50993. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  50994. -----END CERTIFICATE-----
  50995. Certplus Class 2 Primary CA
  50996. ===========================
  50997. -----BEGIN CERTIFICATE-----
  50998. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  50999. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  51000. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  51001. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  51002. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  51003. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  51004. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  51005. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  51006. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  51007. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  51008. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  51009. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  51010. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  51011. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  51012. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  51013. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  51014. l7+ijrRU
  51015. -----END CERTIFICATE-----
  51016. DST Root CA X3
  51017. ==============
  51018. -----BEGIN CERTIFICATE-----
  51019. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  51020. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  51021. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  51022. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  51023. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  51024. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  51025. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  51026. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  51027. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  51028. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  51029. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  51030. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  51031. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  51032. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  51033. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  51034. -----END CERTIFICATE-----
  51035. DST ACES CA X6
  51036. ==============
  51037. -----BEGIN CERTIFICATE-----
  51038. MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQG
  51039. EwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QxETAPBgNVBAsTCERTVCBBQ0VT
  51040. MRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0wMzExMjAyMTE5NThaFw0xNzExMjAyMTE5NTha
  51041. MFsxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UE
  51042. CxMIRFNUIEFDRVMxFzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOC
  51043. AQ8AMIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPuktKe1jzI
  51044. DZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7gLFViYsx+tC3dr5BPTCa
  51045. pCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZHfAjIgrrep4c9oW24MFbCswKBXy314pow
  51046. GCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4aahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPy
  51047. MjwmR/onJALJfh1biEITajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1Ud
  51048. EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rkc3Qu
  51049. Y29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjtodHRwOi8vd3d3LnRy
  51050. dXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMtaW5kZXguaHRtbDAdBgNVHQ4EFgQU
  51051. CXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZIhvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V2
  51052. 5FYrnJmQ6AgwbN99Pe7lv7UkQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t
  51053. Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq
  51054. nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs
  51055. vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3
  51056. oKfN5XozNmr6mis=
  51057. -----END CERTIFICATE-----
  51058. SwissSign Gold CA - G2
  51059. ======================
  51060. -----BEGIN CERTIFICATE-----
  51061. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  51062. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  51063. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  51064. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  51065. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  51066. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  51067. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  51068. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  51069. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  51070. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  51071. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  51072. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  51073. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  51074. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  51075. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  51076. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  51077. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  51078. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  51079. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  51080. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  51081. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  51082. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  51083. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  51084. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  51085. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  51086. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  51087. -----END CERTIFICATE-----
  51088. SwissSign Silver CA - G2
  51089. ========================
  51090. -----BEGIN CERTIFICATE-----
  51091. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  51092. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  51093. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  51094. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  51095. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  51096. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  51097. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  51098. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  51099. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  51100. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  51101. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  51102. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  51103. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  51104. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  51105. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  51106. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  51107. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  51108. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  51109. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  51110. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  51111. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  51112. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  51113. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  51114. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  51115. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  51116. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  51117. -----END CERTIFICATE-----
  51118. GeoTrust Primary Certification Authority
  51119. ========================================
  51120. -----BEGIN CERTIFICATE-----
  51121. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  51122. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  51123. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  51124. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  51125. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  51126. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  51127. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  51128. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  51129. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  51130. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  51131. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  51132. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  51133. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  51134. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  51135. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  51136. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  51137. -----END CERTIFICATE-----
  51138. thawte Primary Root CA
  51139. ======================
  51140. -----BEGIN CERTIFICATE-----
  51141. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  51142. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  51143. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  51144. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  51145. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  51146. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  51147. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  51148. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  51149. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  51150. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  51151. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  51152. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  51153. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  51154. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  51155. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  51156. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  51157. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  51158. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  51159. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  51160. -----END CERTIFICATE-----
  51161. VeriSign Class 3 Public Primary Certification Authority - G5
  51162. ============================================================
  51163. -----BEGIN CERTIFICATE-----
  51164. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  51165. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  51166. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  51167. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  51168. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  51169. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  51170. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  51171. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  51172. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  51173. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  51174. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  51175. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  51176. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  51177. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  51178. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  51179. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  51180. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  51181. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  51182. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  51183. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  51184. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  51185. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  51186. -----END CERTIFICATE-----
  51187. SecureTrust CA
  51188. ==============
  51189. -----BEGIN CERTIFICATE-----
  51190. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  51191. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  51192. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  51193. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  51194. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  51195. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  51196. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  51197. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  51198. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  51199. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  51200. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  51201. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  51202. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  51203. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  51204. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  51205. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  51206. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  51207. -----END CERTIFICATE-----
  51208. Secure Global CA
  51209. ================
  51210. -----BEGIN CERTIFICATE-----
  51211. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  51212. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  51213. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  51214. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  51215. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  51216. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  51217. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  51218. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  51219. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  51220. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  51221. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  51222. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  51223. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  51224. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  51225. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  51226. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  51227. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  51228. -----END CERTIFICATE-----
  51229. COMODO Certification Authority
  51230. ==============================
  51231. -----BEGIN CERTIFICATE-----
  51232. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  51233. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  51234. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  51235. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  51236. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  51237. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  51238. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  51239. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  51240. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  51241. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  51242. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  51243. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  51244. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  51245. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  51246. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  51247. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  51248. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  51249. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  51250. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  51251. -----END CERTIFICATE-----
  51252. Network Solutions Certificate Authority
  51253. =======================================
  51254. -----BEGIN CERTIFICATE-----
  51255. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  51256. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  51257. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  51258. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  51259. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  51260. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  51261. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  51262. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  51263. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  51264. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  51265. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  51266. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  51267. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  51268. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  51269. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  51270. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  51271. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  51272. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  51273. -----END CERTIFICATE-----
  51274. COMODO ECC Certification Authority
  51275. ==================================
  51276. -----BEGIN CERTIFICATE-----
  51277. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  51278. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  51279. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  51280. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  51281. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  51282. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  51283. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  51284. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  51285. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  51286. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  51287. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  51288. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  51289. -----END CERTIFICATE-----
  51290. Security Communication EV RootCA1
  51291. =================================
  51292. -----BEGIN CERTIFICATE-----
  51293. MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  51294. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh
  51295. dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE
  51296. BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl
  51297. Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  51298. AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO
  51299. /VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX
  51300. WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z
  51301. ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4
  51302. bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK
  51303. 9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
  51304. SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm
  51305. iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG
  51306. Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW
  51307. mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW
  51308. T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490
  51309. -----END CERTIFICATE-----
  51310. OISTE WISeKey Global Root GA CA
  51311. ===============================
  51312. -----BEGIN CERTIFICATE-----
  51313. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  51314. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  51315. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  51316. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  51317. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  51318. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  51319. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  51320. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  51321. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  51322. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  51323. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  51324. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  51325. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  51326. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  51327. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  51328. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  51329. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  51330. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  51331. -----END CERTIFICATE-----
  51332. Certigna
  51333. ========
  51334. -----BEGIN CERTIFICATE-----
  51335. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  51336. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  51337. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  51338. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  51339. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  51340. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  51341. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  51342. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  51343. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  51344. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  51345. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  51346. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  51347. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  51348. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  51349. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  51350. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  51351. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  51352. -----END CERTIFICATE-----
  51353. Deutsche Telekom Root CA 2
  51354. ==========================
  51355. -----BEGIN CERTIFICATE-----
  51356. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  51357. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  51358. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  51359. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  51360. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  51361. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  51362. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  51363. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  51364. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  51365. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  51366. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  51367. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  51368. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  51369. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  51370. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  51371. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  51372. Cm26OWMohpLzGITY+9HPBVZkVw==
  51373. -----END CERTIFICATE-----
  51374. Cybertrust Global Root
  51375. ======================
  51376. -----BEGIN CERTIFICATE-----
  51377. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  51378. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  51379. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  51380. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  51381. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  51382. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  51383. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  51384. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  51385. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  51386. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  51387. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  51388. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  51389. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  51390. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  51391. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  51392. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  51393. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  51394. -----END CERTIFICATE-----
  51395. ePKI Root Certification Authority
  51396. =================================
  51397. -----BEGIN CERTIFICATE-----
  51398. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  51399. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  51400. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  51401. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  51402. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  51403. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  51404. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  51405. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  51406. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  51407. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  51408. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  51409. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  51410. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  51411. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  51412. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  51413. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  51414. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  51415. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  51416. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  51417. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  51418. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  51419. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  51420. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  51421. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  51422. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  51423. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  51424. -----END CERTIFICATE-----
  51425. T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3
  51426. =============================================================================================================================
  51427. -----BEGIN CERTIFICATE-----
  51428. MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRSMRgwFgYDVQQH
  51429. DA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJpbGltc2VsIHZlIFRla25vbG9q
  51430. aWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSwVEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ry
  51431. b25payB2ZSBLcmlwdG9sb2ppIEFyYcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNV
  51432. BAsMGkthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUg
  51433. S8O2ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAeFw0wNzA4
  51434. MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIxGDAWBgNVBAcMD0dlYnpl
  51435. IC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmlsaW1zZWwgdmUgVGVrbm9sb2ppayBBcmHF
  51436. n3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBUQUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZl
  51437. IEtyaXB0b2xvamkgQXJhxZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2Ft
  51438. dSBTZXJ0aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7ZrIFNl
  51439. cnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIBIjANBgkqhkiG9w0B
  51440. AQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4hgb46ezzb8R1Sf1n68yJMlaCQvEhO
  51441. Eav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yKO7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1
  51442. xnnRFDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR
  51443. 6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL
  51444. hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd
  51445. BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  51446. MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4
  51447. N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT
  51448. y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh
  51449. LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M
  51450. dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI=
  51451. -----END CERTIFICATE-----
  51452. certSIGN ROOT CA
  51453. ================
  51454. -----BEGIN CERTIFICATE-----
  51455. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  51456. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  51457. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  51458. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  51459. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  51460. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  51461. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  51462. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  51463. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  51464. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  51465. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  51466. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  51467. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  51468. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  51469. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  51470. -----END CERTIFICATE-----
  51471. GeoTrust Primary Certification Authority - G3
  51472. =============================================
  51473. -----BEGIN CERTIFICATE-----
  51474. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  51475. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  51476. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  51477. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  51478. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  51479. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  51480. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  51481. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  51482. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  51483. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  51484. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  51485. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  51486. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  51487. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  51488. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  51489. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  51490. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  51491. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  51492. -----END CERTIFICATE-----
  51493. thawte Primary Root CA - G2
  51494. ===========================
  51495. -----BEGIN CERTIFICATE-----
  51496. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  51497. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  51498. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  51499. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  51500. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  51501. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  51502. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  51503. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  51504. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  51505. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  51506. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  51507. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  51508. -----END CERTIFICATE-----
  51509. thawte Primary Root CA - G3
  51510. ===========================
  51511. -----BEGIN CERTIFICATE-----
  51512. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  51513. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  51514. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  51515. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  51516. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  51517. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  51518. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  51519. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  51520. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  51521. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  51522. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  51523. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  51524. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  51525. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  51526. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  51527. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  51528. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  51529. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  51530. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  51531. -----END CERTIFICATE-----
  51532. GeoTrust Primary Certification Authority - G2
  51533. =============================================
  51534. -----BEGIN CERTIFICATE-----
  51535. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  51536. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  51537. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  51538. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  51539. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  51540. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  51541. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  51542. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  51543. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  51544. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  51545. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  51546. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  51547. npaqBA+K
  51548. -----END CERTIFICATE-----
  51549. VeriSign Universal Root Certification Authority
  51550. ===============================================
  51551. -----BEGIN CERTIFICATE-----
  51552. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  51553. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  51554. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  51555. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  51556. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  51557. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  51558. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  51559. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  51560. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  51561. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  51562. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  51563. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  51564. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  51565. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  51566. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  51567. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  51568. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  51569. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  51570. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  51571. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  51572. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  51573. mJO37M2CYfE45k+XmCpajQ==
  51574. -----END CERTIFICATE-----
  51575. VeriSign Class 3 Public Primary Certification Authority - G4
  51576. ============================================================
  51577. -----BEGIN CERTIFICATE-----
  51578. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  51579. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  51580. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  51581. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  51582. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  51583. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  51584. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  51585. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  51586. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  51587. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  51588. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  51589. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  51590. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  51591. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  51592. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  51593. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  51594. -----END CERTIFICATE-----
  51595. NetLock Arany (Class Gold) Főtanúsítvány
  51596. ========================================
  51597. -----BEGIN CERTIFICATE-----
  51598. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  51599. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  51600. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  51601. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  51602. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  51603. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  51604. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  51605. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  51606. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  51607. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  51608. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  51609. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  51610. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  51611. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  51612. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  51613. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  51614. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  51615. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  51616. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  51617. -----END CERTIFICATE-----
  51618. Staat der Nederlanden Root CA - G2
  51619. ==================================
  51620. -----BEGIN CERTIFICATE-----
  51621. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  51622. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  51623. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  51624. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  51625. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  51626. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  51627. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  51628. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  51629. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  51630. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  51631. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  51632. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  51633. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  51634. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  51635. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  51636. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  51637. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  51638. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  51639. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  51640. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  51641. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  51642. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  51643. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  51644. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  51645. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  51646. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  51647. 66+KAQ==
  51648. -----END CERTIFICATE-----
  51649. Hongkong Post Root CA 1
  51650. =======================
  51651. -----BEGIN CERTIFICATE-----
  51652. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  51653. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  51654. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  51655. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  51656. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  51657. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  51658. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  51659. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  51660. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  51661. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  51662. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  51663. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  51664. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  51665. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  51666. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  51667. -----END CERTIFICATE-----
  51668. SecureSign RootCA11
  51669. ===================
  51670. -----BEGIN CERTIFICATE-----
  51671. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  51672. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  51673. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  51674. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  51675. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  51676. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  51677. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  51678. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  51679. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  51680. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  51681. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  51682. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  51683. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  51684. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  51685. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  51686. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  51687. -----END CERTIFICATE-----
  51688. ACEDICOM Root
  51689. =============
  51690. -----BEGIN CERTIFICATE-----
  51691. MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UEAwwNQUNFRElD
  51692. T00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMB4XDTA4
  51693. MDQxODE2MjQyMloXDTI4MDQxMzE2MjQyMlowRDEWMBQGA1UEAwwNQUNFRElDT00gUm9vdDEMMAoG
  51694. A1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMIICIjANBgkqhkiG9w0BAQEF
  51695. AAOCAg8AMIICCgKCAgEA/5KV4WgGdrQsyFhIyv2AVClVYyT/kGWbEHV7w2rbYgIB8hiGtXxaOLHk
  51696. WLn709gtn70yN78sFW2+tfQh0hOR2QetAQXW8713zl9CgQr5auODAKgrLlUTY4HKRxx7XBZXehuD
  51697. YAQ6PmXDzQHe3qTWDLqO3tkE7hdWIpuPY/1NFgu3e3eM+SW10W2ZEi5PGrjm6gSSrj0RuVFCPYew
  51698. MYWveVqc/udOXpJPQ/yrOq2lEiZmueIM15jO1FillUAKt0SdE3QrwqXrIhWYENiLxQSfHY9g5QYb
  51699. m8+5eaA9oiM/Qj9r+hwDezCNzmzAv+YbX79nuIQZ1RXve8uQNjFiybwCq0Zfm/4aaJQ0PZCOrfbk
  51700. HQl/Sog4P75n/TSW9R28MHTLOO7VbKvU/PQAtwBbhTIWdjPp2KOZnQUAqhbm84F9b32qhm2tFXTT
  51701. xKJxqvQUfecyuB+81fFOvW8XAjnXDpVCOscAPukmYxHqC9FK/xidstd7LzrZlvvoHpKuE1XI2Sf2
  51702. 3EgbsCTBheN3nZqk8wwRHQ3ItBTutYJXCb8gWH8vIiPYcMt5bMlL8qkqyPyHK9caUPgn6C9D4zq9
  51703. 2Fdx/c6mUlv53U3t5fZvie27k5x2IXXwkkwp9y+cAS7+UEaeZAwUswdbxcJzbPEHXEUkFDWug/Fq
  51704. TYl6+rPYLWbwNof1K1MCAwEAAaOBqjCBpzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKaz
  51705. 4SsrSbbXc6GqlPUB53NlTKxQMA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUprPhKytJttdzoaqU
  51706. 9QHnc2VMrFAwRAYDVR0gBD0wOzA5BgRVHSAAMDEwLwYIKwYBBQUHAgEWI2h0dHA6Ly9hY2VkaWNv
  51707. bS5lZGljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWImfQwng4/F9tqg
  51708. aHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3gvoFNTPhNahXwOf9jU8/kzJP
  51709. eGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKeI6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1Pwk
  51710. zQSulgUV1qzOMPPKC8W64iLgpq0i5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1
  51711. ThCojz2GuHURwCRiipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oI
  51712. KiMnMCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZo5NjEFIq
  51713. nxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6zqylfDJKZ0DcMDQj3dcE
  51714. I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp
  51715. MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o
  51716. tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==
  51717. -----END CERTIFICATE-----
  51718. Microsec e-Szigno Root CA 2009
  51719. ==============================
  51720. -----BEGIN CERTIFICATE-----
  51721. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  51722. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  51723. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  51724. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  51725. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  51726. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  51727. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  51728. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  51729. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  51730. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  51731. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  51732. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  51733. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  51734. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  51735. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  51736. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  51737. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  51738. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  51739. LXpUq3DDfSJlgnCW
  51740. -----END CERTIFICATE-----
  51741. GlobalSign Root CA - R3
  51742. =======================
  51743. -----BEGIN CERTIFICATE-----
  51744. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  51745. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  51746. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  51747. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  51748. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  51749. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  51750. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  51751. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  51752. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  51753. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  51754. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  51755. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  51756. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  51757. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  51758. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  51759. kpeDMdmztcpHWD9f
  51760. -----END CERTIFICATE-----
  51761. Autoridad de Certificacion Firmaprofesional CIF A62634068
  51762. =========================================================
  51763. -----BEGIN CERTIFICATE-----
  51764. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  51765. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  51766. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  51767. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  51768. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  51769. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  51770. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  51771. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  51772. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  51773. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  51774. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  51775. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  51776. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  51777. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  51778. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  51779. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  51780. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  51781. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  51782. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  51783. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  51784. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  51785. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  51786. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  51787. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  51788. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  51789. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  51790. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  51791. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  51792. -----END CERTIFICATE-----
  51793. Izenpe.com
  51794. ==========
  51795. -----BEGIN CERTIFICATE-----
  51796. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  51797. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  51798. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  51799. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  51800. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  51801. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  51802. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  51803. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  51804. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  51805. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  51806. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  51807. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  51808. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  51809. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  51810. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  51811. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  51812. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  51813. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  51814. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  51815. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  51816. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  51817. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  51818. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  51819. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  51820. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  51821. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  51822. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  51823. -----END CERTIFICATE-----
  51824. Chambers of Commerce Root - 2008
  51825. ================================
  51826. -----BEGIN CERTIFICATE-----
  51827. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  51828. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  51829. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  51830. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  51831. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  51832. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  51833. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  51834. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  51835. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  51836. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  51837. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  51838. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  51839. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  51840. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  51841. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  51842. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  51843. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  51844. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  51845. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  51846. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  51847. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  51848. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  51849. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  51850. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  51851. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  51852. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  51853. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  51854. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  51855. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  51856. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  51857. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  51858. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  51859. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  51860. -----END CERTIFICATE-----
  51861. Global Chambersign Root - 2008
  51862. ==============================
  51863. -----BEGIN CERTIFICATE-----
  51864. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  51865. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  51866. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  51867. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  51868. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  51869. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  51870. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  51871. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  51872. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  51873. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  51874. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  51875. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  51876. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  51877. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  51878. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  51879. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  51880. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  51881. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  51882. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  51883. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  51884. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  51885. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  51886. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  51887. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  51888. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  51889. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  51890. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  51891. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  51892. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  51893. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  51894. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  51895. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  51896. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  51897. -----END CERTIFICATE-----
  51898. Go Daddy Root Certificate Authority - G2
  51899. ========================================
  51900. -----BEGIN CERTIFICATE-----
  51901. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  51902. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  51903. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  51904. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  51905. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  51906. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  51907. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  51908. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  51909. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  51910. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  51911. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  51912. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  51913. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  51914. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  51915. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  51916. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  51917. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  51918. -----END CERTIFICATE-----
  51919. Starfield Root Certificate Authority - G2
  51920. =========================================
  51921. -----BEGIN CERTIFICATE-----
  51922. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  51923. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  51924. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  51925. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  51926. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  51927. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  51928. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  51929. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  51930. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  51931. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  51932. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  51933. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  51934. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  51935. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  51936. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  51937. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  51938. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  51939. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  51940. -----END CERTIFICATE-----
  51941. Starfield Services Root Certificate Authority - G2
  51942. ==================================================
  51943. -----BEGIN CERTIFICATE-----
  51944. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  51945. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  51946. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  51947. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  51948. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  51949. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  51950. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  51951. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  51952. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  51953. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  51954. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  51955. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  51956. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  51957. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  51958. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  51959. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  51960. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  51961. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  51962. -----END CERTIFICATE-----
  51963. AffirmTrust Commercial
  51964. ======================
  51965. -----BEGIN CERTIFICATE-----
  51966. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  51967. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  51968. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  51969. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  51970. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  51971. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  51972. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  51973. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  51974. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  51975. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  51976. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  51977. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  51978. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  51979. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  51980. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  51981. -----END CERTIFICATE-----
  51982. AffirmTrust Networking
  51983. ======================
  51984. -----BEGIN CERTIFICATE-----
  51985. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  51986. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  51987. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  51988. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  51989. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  51990. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  51991. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  51992. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  51993. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  51994. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  51995. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  51996. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  51997. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  51998. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  51999. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  52000. -----END CERTIFICATE-----
  52001. AffirmTrust Premium
  52002. ===================
  52003. -----BEGIN CERTIFICATE-----
  52004. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  52005. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  52006. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  52007. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  52008. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  52009. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  52010. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  52011. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  52012. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  52013. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  52014. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  52015. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  52016. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  52017. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  52018. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  52019. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  52020. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  52021. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  52022. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  52023. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  52024. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  52025. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  52026. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  52027. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  52028. -----END CERTIFICATE-----
  52029. AffirmTrust Premium ECC
  52030. =======================
  52031. -----BEGIN CERTIFICATE-----
  52032. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  52033. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  52034. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  52035. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  52036. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  52037. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  52038. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  52039. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  52040. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  52041. eQ==
  52042. -----END CERTIFICATE-----
  52043. Certum Trusted Network CA
  52044. =========================
  52045. -----BEGIN CERTIFICATE-----
  52046. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  52047. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  52048. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  52049. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  52050. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  52051. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  52052. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  52053. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  52054. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  52055. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  52056. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  52057. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  52058. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  52059. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  52060. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  52061. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  52062. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  52063. -----END CERTIFICATE-----
  52064. Certinomis - Autorité Racine
  52065. ============================
  52066. -----BEGIN CERTIFICATE-----
  52067. MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  52068. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg
  52069. LSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkG
  52070. A1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYw
  52071. JAYDVQQDDB1DZXJ0aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQAD
  52072. ggIPADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jYF1AMnmHa
  52073. wE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N8y4oH3DfVS9O7cdxbwly
  52074. Lu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWerP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw
  52075. 2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92N
  52076. jMD2AR5vpTESOH2VwnHu7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9q
  52077. c1pkIuVC28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6lSTC
  52078. lrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1Enn1So2+WLhl+HPNb
  52079. xxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB0iSVL1N6aaLwD4ZFjliCK0wi1F6g
  52080. 530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql095gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna
  52081. 4NH4+ej9Uji29YnfAgMBAAGjWzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
  52082. A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ
  52083. KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x
  52084. WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva
  52085. R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40
  52086. nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B
  52087. CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv
  52088. JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE
  52089. qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b
  52090. WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE
  52091. wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/
  52092. vgt2Fl43N+bYdJeimUV5
  52093. -----END CERTIFICATE-----
  52094. TWCA Root Certification Authority
  52095. =================================
  52096. -----BEGIN CERTIFICATE-----
  52097. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  52098. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  52099. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  52100. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  52101. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  52102. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  52103. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  52104. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  52105. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  52106. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  52107. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  52108. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  52109. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  52110. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  52111. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  52112. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  52113. -----END CERTIFICATE-----
  52114. Security Communication RootCA2
  52115. ==============================
  52116. -----BEGIN CERTIFICATE-----
  52117. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  52118. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  52119. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  52120. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  52121. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  52122. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  52123. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  52124. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  52125. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  52126. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  52127. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  52128. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  52129. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  52130. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  52131. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  52132. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  52133. -----END CERTIFICATE-----
  52134. EC-ACC
  52135. ======
  52136. -----BEGIN CERTIFICATE-----
  52137. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  52138. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  52139. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  52140. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  52141. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  52142. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  52143. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  52144. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  52145. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  52146. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  52147. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  52148. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  52149. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  52150. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  52151. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  52152. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  52153. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  52154. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  52155. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  52156. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  52157. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  52158. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  52159. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  52160. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  52161. 5EI=
  52162. -----END CERTIFICATE-----
  52163. Hellenic Academic and Research Institutions RootCA 2011
  52164. =======================================================
  52165. -----BEGIN CERTIFICATE-----
  52166. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  52167. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  52168. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  52169. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  52170. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  52171. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  52172. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  52173. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  52174. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  52175. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  52176. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  52177. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  52178. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  52179. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  52180. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  52181. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  52182. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  52183. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  52184. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  52185. -----END CERTIFICATE-----
  52186. Actalis Authentication Root CA
  52187. ==============================
  52188. -----BEGIN CERTIFICATE-----
  52189. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  52190. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  52191. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  52192. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  52193. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  52194. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  52195. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  52196. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  52197. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  52198. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  52199. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  52200. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  52201. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  52202. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  52203. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  52204. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  52205. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  52206. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  52207. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  52208. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  52209. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  52210. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  52211. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  52212. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  52213. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  52214. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  52215. -----END CERTIFICATE-----
  52216. Trustis FPS Root CA
  52217. ===================
  52218. -----BEGIN CERTIFICATE-----
  52219. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  52220. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  52221. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  52222. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  52223. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  52224. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  52225. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  52226. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  52227. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  52228. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  52229. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  52230. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  52231. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  52232. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  52233. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  52234. iB6XzCGcKQENZetX2fNXlrtIzYE=
  52235. -----END CERTIFICATE-----
  52236. StartCom Certification Authority
  52237. ================================
  52238. -----BEGIN CERTIFICATE-----
  52239. MIIHhzCCBW+gAwIBAgIBLTANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  52240. U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
  52241. ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
  52242. NjM3WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
  52243. LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
  52244. U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
  52245. ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
  52246. o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
  52247. Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
  52248. eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
  52249. 2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
  52250. 6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
  52251. osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
  52252. untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
  52253. UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
  52254. 37uMdBNSSwIDAQABo4ICEDCCAgwwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD
  52255. VR0OBBYEFE4L7xqkQFulF2mHMMo0aEPQQa7yMB8GA1UdIwQYMBaAFE4L7xqkQFulF2mHMMo0aEPQ
  52256. Qa7yMIIBWgYDVR0gBIIBUTCCAU0wggFJBgsrBgEEAYG1NwEBATCCATgwLgYIKwYBBQUHAgEWImh0
  52257. dHA6Ly93d3cuc3RhcnRzc2wuY29tL3BvbGljeS5wZGYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cu
  52258. c3RhcnRzc2wuY29tL2ludGVybWVkaWF0ZS5wZGYwgc8GCCsGAQUFBwICMIHCMCcWIFN0YXJ0IENv
  52259. bW1lcmNpYWwgKFN0YXJ0Q29tKSBMdGQuMAMCAQEagZZMaW1pdGVkIExpYWJpbGl0eSwgcmVhZCB0
  52260. aGUgc2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBTdGFydENvbSBDZXJ0aWZpY2F0
  52261. aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6Ly93d3cuc3RhcnRzc2wuY29t
  52262. L3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBG
  52263. cmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQsFAAOCAgEAjo/n3JR5
  52264. fPGFf59Jb2vKXfuM/gTFwWLRfUKKvFO3lANmMD+x5wqnUCBVJX92ehQN6wQOQOY+2IirByeDqXWm
  52265. N3PH/UvSTa0XQMhGvjt/UfzDtgUx3M2FIk5xt/JxXrAaxrqTi3iSSoX4eA+D/i+tLPfkpLst0OcN
  52266. Org+zvZ49q5HJMqjNTbOx8aHmNrs++myziebiMMEofYLWWivydsQD032ZGNcpRJvkrKTlMeIFw6T
  52267. tn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKlCcWw0bdT82AUuoVpaiF8H3VhFyAX
  52268. e2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVFP0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA
  52269. 2MFrLH9ZXF2RsXAiV+uKa0hK1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBs
  52270. HvUwyKMQ5bLmKhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE
  52271. JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ8dCAWZvLMdib
  52272. D4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnmfyWl8kgAwKQB2j8=
  52273. -----END CERTIFICATE-----
  52274. StartCom Certification Authority G2
  52275. ===================================
  52276. -----BEGIN CERTIFICATE-----
  52277. MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  52278. U3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg
  52279. RzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UE
  52280. ChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  52281. dHkgRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8O
  52282. o1XJJZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsDvfOpL9HG
  52283. 4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnooD/Uefyf3lLE3PbfHkffi
  52284. Aez9lInhzG7TNtYKGXmu1zSCZf98Qru23QumNK9LYP5/Q0kGi4xDuFby2X8hQxfqp0iVAXV16iul
  52285. Q5XqFYSdCI0mblWbq9zSOdIxHWDirMxWRST1HFSr7obdljKF+ExP6JV2tgXdNiNnvP8V4so75qbs
  52286. O+wmETRIjfaAKxojAuuKHDp2KntWFhxyKrOq42ClAJ8Em+JvHhRYW6Vsi1g8w7pOOlz34ZYrPu8H
  52287. vKTlXcxNnw3h3Kq74W4a7I/htkxNeXJdFzULHdfBR9qWJODQcqhaX2YtENwvKhOuJv4KHBnM0D4L
  52288. nMgJLvlblnpHnOl68wVQdJVznjAJ85eCXuaPOQgeWeU1FEIT/wCc976qUM/iUUjXuG+v+E5+M5iS
  52289. FGI6dWPPe/regjupuznixL0sAA7IF6wT700ljtizkC+p2il9Ha90OrInwMEePnWjFqmveiJdnxMa
  52290. z6eg6+OGCtP95paV1yPIN93EfKo2rJgaErHgTuixO/XWb/Ew1wIDAQABo0IwQDAPBgNVHRMBAf8E
  52291. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUS8W0QGutHLOlHGVuRjaJhwUMDrYwDQYJ
  52292. KoZIhvcNAQELBQADggIBAHNXPyzVlTJ+N9uWkusZXn5T50HsEbZH77Xe7XRcxfGOSeD8bpkTzZ+K
  52293. 2s06Ctg6Wgk/XzTQLwPSZh0avZyQN8gMjgdalEVGKua+etqhqaRpEpKwfTbURIfXUfEpY9Z1zRbk
  52294. J4kd+MIySP3bmdCPX1R0zKxnNBFi2QwKN4fRoxdIjtIXHfbX/dtl6/2o1PXWT6RbdejF0mCy2wl+
  52295. JYt7ulKSnj7oxXehPOBKc2thz4bcQ///If4jXSRK9dNtD2IEBVeC2m6kMyV5Sy5UGYvMLD0w6dEG
  52296. /+gyRr61M3Z3qAFdlsHB1b6uJcDJHgoJIIihDsnzb02CVAAgp9KP5DlUFy6NHrgbuxu9mk47EDTc
  52297. nIhT76IxW1hPkWLIwpqazRVdOKnWvvgTtZ8SafJQYqz7Fzf07rh1Z2AQ+4NQ+US1dZxAF7L+/Xld
  52298. blhYXzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5lIxKVCCIc
  52299. l85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoohdVddLHRDiBYmxOlsGOm
  52300. 7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulrso8uBtjRkcfGEvRM/TAXw8HaOFvjqerm
  52301. obp573PYtlNXLfbQ4ddI
  52302. -----END CERTIFICATE-----
  52303. Buypass Class 2 Root CA
  52304. =======================
  52305. -----BEGIN CERTIFICATE-----
  52306. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  52307. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  52308. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  52309. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  52310. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  52311. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  52312. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  52313. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  52314. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  52315. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  52316. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  52317. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  52318. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  52319. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  52320. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  52321. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  52322. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  52323. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  52324. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  52325. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  52326. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  52327. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  52328. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  52329. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  52330. rJgWVqA=
  52331. -----END CERTIFICATE-----
  52332. Buypass Class 3 Root CA
  52333. =======================
  52334. -----BEGIN CERTIFICATE-----
  52335. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  52336. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  52337. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  52338. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  52339. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  52340. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  52341. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  52342. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  52343. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  52344. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  52345. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  52346. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  52347. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  52348. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  52349. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  52350. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  52351. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  52352. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  52353. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  52354. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  52355. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  52356. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  52357. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  52358. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  52359. Cp/HuZc=
  52360. -----END CERTIFICATE-----
  52361. T-TeleSec GlobalRoot Class 3
  52362. ============================
  52363. -----BEGIN CERTIFICATE-----
  52364. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  52365. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  52366. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  52367. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  52368. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  52369. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  52370. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  52371. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  52372. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  52373. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  52374. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  52375. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  52376. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  52377. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  52378. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  52379. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  52380. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  52381. -----END CERTIFICATE-----
  52382. EE Certification Centre Root CA
  52383. ===============================
  52384. -----BEGIN CERTIFICATE-----
  52385. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  52386. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  52387. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  52388. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  52389. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  52390. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  52391. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  52392. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  52393. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  52394. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  52395. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  52396. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  52397. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  52398. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  52399. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  52400. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  52401. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  52402. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  52403. dcGWxZ0=
  52404. -----END CERTIFICATE-----
  52405. TURKTRUST Certificate Services Provider Root 2007
  52406. =================================================
  52407. -----BEGIN CERTIFICATE-----
  52408. MIIEPTCCAyWgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvzE/MD0GA1UEAww2VMOcUktUUlVTVCBF
  52409. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP
  52410. MA0GA1UEBwwGQW5rYXJhMV4wXAYDVQQKDFVUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg
  52411. QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgQXJhbMSxayAyMDA3MB4X
  52412. DTA3MTIyNTE4MzcxOVoXDTE3MTIyMjE4MzcxOVowgb8xPzA9BgNVBAMMNlTDnFJLVFJVU1QgRWxl
  52413. a3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTELMAkGA1UEBhMCVFIxDzAN
  52414. BgNVBAcMBkFua2FyYTFeMFwGA1UECgxVVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  52415. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4gKGMpIEFyYWzEsWsgMjAwNzCCASIw
  52416. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKu3PgqMyKVYFeaK7yc9SrToJdPNM8Ig3BnuiD9N
  52417. YvDdE3ePYakqtdTyuTFYKTsvP2qcb3N2Je40IIDu6rfwxArNK4aUyeNgsURSsloptJGXg9i3phQv
  52418. KUmi8wUG+7RP2qFsmmaf8EMJyupyj+sA1zU511YXRxcw9L6/P8JorzZAwan0qafoEGsIiveGHtya
  52419. KhUG9qPw9ODHFNRRf8+0222vR5YXm3dx2KdxnSQM9pQ/hTEST7ruToK4uT6PIzdezKKqdfcYbwnT
  52420. rqdUKDT74eA7YH2gvnmJhsifLfkKS8RQouf9eRbHegsYz85M733WB2+Y8a+xwXrXgTW4qhe04MsC
  52421. AwEAAaNCMEAwHQYDVR0OBBYEFCnFkKslrxHkYb+j/4hhkeYO/pyBMA4GA1UdDwEB/wQEAwIBBjAP
  52422. BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAQDdr4Ouwo0RSVgrESLFF6QSU2TJ/s
  52423. Px+EnWVUXKgWAkD6bho3hO9ynYYKVZ1WKKxmLNA6VpM0ByWtCLCPyA8JWcqdmBzlVPi5RX9ql2+I
  52424. aE1KBiY3iAIOtsbWcpnOa3faYjGkVh+uX4132l32iPwa2Z61gfAyuOOI0JzzaqC5mxRZNTZPz/OO
  52425. Xl0XrRWV2N2y1RVuAE6zS89mlOTgzbUF2mNXi+WzqtvALhyQRNsaXRik7r4EW5nVcV9VZWRi1aKb
  52426. BFmGyGJ353yCRWo9F7/snXUMrqNvWtMvmDb08PUZqxFdyKbjKlhqQgnDvZImZjINXQhVdP+MmNAK
  52427. poRq0Tl9
  52428. -----END CERTIFICATE-----
  52429. D-TRUST Root Class 3 CA 2 2009
  52430. ==============================
  52431. -----BEGIN CERTIFICATE-----
  52432. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  52433. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  52434. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  52435. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  52436. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  52437. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  52438. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  52439. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  52440. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  52441. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  52442. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  52443. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  52444. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  52445. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  52446. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  52447. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  52448. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  52449. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  52450. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  52451. -----END CERTIFICATE-----
  52452. D-TRUST Root Class 3 CA 2 EV 2009
  52453. =================================
  52454. -----BEGIN CERTIFICATE-----
  52455. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  52456. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  52457. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  52458. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  52459. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  52460. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  52461. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  52462. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  52463. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  52464. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  52465. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  52466. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  52467. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  52468. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  52469. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  52470. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  52471. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  52472. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  52473. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  52474. w9y4AyHqnxbxLFS1
  52475. -----END CERTIFICATE-----
  52476. PSCProcert
  52477. ==========
  52478. -----BEGIN CERTIFICATE-----
  52479. MIIJhjCCB26gAwIBAgIBCzANBgkqhkiG9w0BAQsFADCCAR4xPjA8BgNVBAMTNUF1dG9yaWRhZCBk
  52480. ZSBDZXJ0aWZpY2FjaW9uIFJhaXogZGVsIEVzdGFkbyBWZW5lem9sYW5vMQswCQYDVQQGEwJWRTEQ
  52481. MA4GA1UEBxMHQ2FyYWNhczEZMBcGA1UECBMQRGlzdHJpdG8gQ2FwaXRhbDE2MDQGA1UEChMtU2lz
  52482. dGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMUMwQQYDVQQLEzpTdXBl
  52483. cmludGVuZGVuY2lhIGRlIFNlcnZpY2lvcyBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMSUw
  52484. IwYJKoZIhvcNAQkBFhZhY3JhaXpAc3VzY2VydGUuZ29iLnZlMB4XDTEwMTIyODE2NTEwMFoXDTIw
  52485. MTIyNTIzNTk1OVowgdExJjAkBgkqhkiG9w0BCQEWF2NvbnRhY3RvQHByb2NlcnQubmV0LnZlMQ8w
  52486. DQYDVQQHEwZDaGFjYW8xEDAOBgNVBAgTB01pcmFuZGExKjAoBgNVBAsTIVByb3ZlZWRvciBkZSBD
  52487. ZXJ0aWZpY2Fkb3MgUFJPQ0VSVDE2MDQGA1UEChMtU2lzdGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZp
  52488. Y2FjaW9uIEVsZWN0cm9uaWNhMQswCQYDVQQGEwJWRTETMBEGA1UEAxMKUFNDUHJvY2VydDCCAiIw
  52489. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANW39KOUM6FGqVVhSQ2oh3NekS1wwQYalNo97BVC
  52490. wfWMrmoX8Yqt/ICV6oNEolt6Vc5Pp6XVurgfoCfAUFM+jbnADrgV3NZs+J74BCXfgI8Qhd19L3uA
  52491. 3VcAZCP4bsm+lU/hdezgfl6VzbHvvnpC2Mks0+saGiKLt38GieU89RLAu9MLmV+QfI4tL3czkkoh
  52492. RqipCKzx9hEC2ZUWno0vluYC3XXCFCpa1sl9JcLB/KpnheLsvtF8PPqv1W7/U0HU9TI4seJfxPmO
  52493. EO8GqQKJ/+MMbpfg353bIdD0PghpbNjU5Db4g7ayNo+c7zo3Fn2/omnXO1ty0K+qP1xmk6wKImG2
  52494. 0qCZyFSTXai20b1dCl53lKItwIKOvMoDKjSuc/HUtQy9vmebVOvh+qBa7Dh+PsHMosdEMXXqP+UH
  52495. 0quhJZb25uSgXTcYOWEAM11G1ADEtMo88aKjPvM6/2kwLkDd9p+cJsmWN63nOaK/6mnbVSKVUyqU
  52496. td+tFjiBdWbjxywbk5yqjKPK2Ww8F22c3HxT4CAnQzb5EuE8XL1mv6JpIzi4mWCZDlZTOpx+FIyw
  52497. Bm/xhnaQr/2v/pDGj59/i5IjnOcVdo/Vi5QTcmn7K2FjiO/mpF7moxdqWEfLcU8UC17IAggmosvp
  52498. r2uKGcfLFFb14dq12fy/czja+eevbqQ34gcnAgMBAAGjggMXMIIDEzASBgNVHRMBAf8ECDAGAQH/
  52499. AgEBMDcGA1UdEgQwMC6CD3N1c2NlcnRlLmdvYi52ZaAbBgVghl4CAqASDBBSSUYtRy0yMDAwNDAz
  52500. Ni0wMB0GA1UdDgQWBBRBDxk4qpl/Qguk1yeYVKIXTC1RVDCCAVAGA1UdIwSCAUcwggFDgBStuyId
  52501. xuDSAaj9dlBSk+2YwU2u06GCASakggEiMIIBHjE+MDwGA1UEAxM1QXV0b3JpZGFkIGRlIENlcnRp
  52502. ZmljYWNpb24gUmFpeiBkZWwgRXN0YWRvIFZlbmV6b2xhbm8xCzAJBgNVBAYTAlZFMRAwDgYDVQQH
  52503. EwdDYXJhY2FzMRkwFwYDVQQIExBEaXN0cml0byBDYXBpdGFsMTYwNAYDVQQKEy1TaXN0ZW1hIE5h
  52504. Y2lvbmFsIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExQzBBBgNVBAsTOlN1cGVyaW50ZW5k
  52505. ZW5jaWEgZGUgU2VydmljaW9zIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExJTAjBgkqhkiG
  52506. 9w0BCQEWFmFjcmFpekBzdXNjZXJ0ZS5nb2IudmWCAQowDgYDVR0PAQH/BAQDAgEGME0GA1UdEQRG
  52507. MESCDnByb2NlcnQubmV0LnZloBUGBWCGXgIBoAwMClBTQy0wMDAwMDKgGwYFYIZeAgKgEgwQUklG
  52508. LUotMzE2MzUzNzMtNzB2BgNVHR8EbzBtMEagRKBChkBodHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52
  52509. ZS9sY3IvQ0VSVElGSUNBRE8tUkFJWi1TSEEzODRDUkxERVIuY3JsMCOgIaAfhh1sZGFwOi8vYWNy
  52510. YWl6LnN1c2NlcnRlLmdvYi52ZTA3BggrBgEFBQcBAQQrMCkwJwYIKwYBBQUHMAGGG2h0dHA6Ly9v
  52511. Y3NwLnN1c2NlcnRlLmdvYi52ZTBBBgNVHSAEOjA4MDYGBmCGXgMBAjAsMCoGCCsGAQUFBwIBFh5o
  52512. dHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52ZS9kcGMwDQYJKoZIhvcNAQELBQADggIBACtZ6yKZu4Sq
  52513. T96QxtGGcSOeSwORR3C7wJJg7ODU523G0+1ng3dS1fLld6c2suNUvtm7CpsR72H0xpkzmfWvADmN
  52514. g7+mvTV+LFwxNG9s2/NkAZiqlCxB3RWGymspThbASfzXg0gTB1GEMVKIu4YXx2sviiCtxQuPcD4q
  52515. uxtxj7mkoP3YldmvWb8lK5jpY5MvYB7Eqvh39YtsL+1+LrVPQA3uvFd359m21D+VJzog1eWuq2w1
  52516. n8GhHVnchIHuTQfiSLaeS5UtQbHh6N5+LwUeaO6/u5BlOsju6rEYNxxik6SgMexxbJHmpHmJWhSn
  52517. FFAFTKQAVzAswbVhltw+HoSvOULP5dAssSS830DD7X9jSr3hTxJkhpXzsOfIt+FTvZLm8wyWuevo
  52518. 5pLtp4EJFAv8lXrPj9Y0TzYS3F7RNHXGRoAvlQSMx4bEqCaJqD8Zm4G7UaRKhqsLEQ+xrmNTbSjq
  52519. 3TNWOByyrYDT13K9mmyZY+gAu0F2BbdbmRiKw7gSXFbPVgx96OLP7bx0R/vu0xdOIk9W/1DzLuY5
  52520. poLWccret9W6aAjtmcz9opLLabid+Qqkpj5PkygqYWwHJgD/ll9ohri4zspV4KuxPX+Y1zMOWj3Y
  52521. eMLEYC/HYvBhkdI4sPaeVdtAgAUSM84dkpvRabP/v/GSCmE1P93+hvS84Bpxs2Km
  52522. -----END CERTIFICATE-----
  52523. CA Disig Root R1
  52524. ================
  52525. -----BEGIN CERTIFICATE-----
  52526. MIIFaTCCA1GgAwIBAgIJAMMDmu5QkG4oMA0GCSqGSIb3DQEBBQUAMFIxCzAJBgNVBAYTAlNLMRMw
  52527. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  52528. ZyBSb290IFIxMB4XDTEyMDcxOTA5MDY1NloXDTQyMDcxOTA5MDY1NlowUjELMAkGA1UEBhMCU0sx
  52529. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  52530. c2lnIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCqw3j33Jijp1pedxiy
  52531. 3QRkD2P9m5YJgNXoqqXinCaUOuiZc4yd39ffg/N4T0Dhf9Kn0uXKE5Pn7cZ3Xza1lK/oOI7bm+V8
  52532. u8yN63Vz4STN5qctGS7Y1oprFOsIYgrY3LMATcMjfF9DCCMyEtztDK3AfQ+lekLZWnDZv6fXARz2
  52533. m6uOt0qGeKAeVjGu74IKgEH3G8muqzIm1Cxr7X1r5OJeIgpFy4QxTaz+29FHuvlglzmxZcfe+5nk
  52534. CiKxLU3lSCZpq+Kq8/v8kiky6bM+TR8noc2OuRf7JT7JbvN32g0S9l3HuzYQ1VTW8+DiR0jm3hTa
  52535. YVKvJrT1cU/J19IG32PK/yHoWQbgCNWEFVP3Q+V8xaCJmGtzxmjOZd69fwX3se72V6FglcXM6pM6
  52536. vpmumwKjrckWtc7dXpl4fho5frLABaTAgqWjR56M6ly2vGfb5ipN0gTco65F97yLnByn1tUD3AjL
  52537. LhbKXEAz6GfDLuemROoRRRw1ZS0eRWEkG4IupZ0zXWX4Qfkuy5Q/H6MMMSRE7cderVC6xkGbrPAX
  52538. ZcD4XW9boAo0PO7X6oifmPmvTiT6l7Jkdtqr9O3jw2Dv1fkCyC2fg69naQanMVXVz0tv/wQFx1is
  52539. XxYb5dKj6zHbHzMVTdDypVP1y+E9Tmgt2BLdqvLmTZtJ5cUoobqwWsagtQIDAQABo0IwQDAPBgNV
  52540. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUiQq0OJMa5qvum5EY+fU8PjXQ
  52541. 04IwDQYJKoZIhvcNAQEFBQADggIBADKL9p1Kyb4U5YysOMo6CdQbzoaz3evUuii+Eq5FLAR0rBNR
  52542. xVgYZk2C2tXck8An4b58n1KeElb21Zyp9HWc+jcSjxyT7Ff+Bw+r1RL3D65hXlaASfX8MPWbTx9B
  52543. LxyE04nH4toCdu0Jz2zBuByDHBb6lM19oMgY0sidbvW9adRtPTXoHqJPYNcHKfyyo6SdbhWSVhlM
  52544. CrDpfNIZTUJG7L399ldb3Zh+pE3McgODWF3vkzpBemOqfDqo9ayk0d2iLbYq/J8BjuIQscTK5Gfb
  52545. VSUZP/3oNn6z4eGBrxEWi1CXYBmCAMBrTXO40RMHPuq2MU/wQppt4hF05ZSsjYSVPCGvxdpHyN85
  52546. YmLLW1AL14FABZyb7bq2ix4Eb5YgOe2kfSnbSM6C3NQCjR0EMVrHS/BsYVLXtFHCgWzN4funodKS
  52547. ds+xDzdYpPJScWc/DIh4gInByLUfkmO+p3qKViwaqKactV2zY9ATIKHrkWzQjX2v3wvkF7mGnjix
  52548. lAxYjOBVqjtjbZqJYLhkKpLGN/R+Q0O3c+gB53+XD9fyexn9GtePyfqFa3qdnom2piiZk4hA9z7N
  52549. UaPK6u95RyG1/jLix8NRb76AdPCkwzryT+lf3xkK8jsTQ6wxpLPn6/wY1gGp8yqPNg7rtLG8t0zJ
  52550. a7+h89n07eLw4+1knj0vllJPgFOL
  52551. -----END CERTIFICATE-----
  52552. CA Disig Root R2
  52553. ================
  52554. -----BEGIN CERTIFICATE-----
  52555. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  52556. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  52557. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  52558. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  52559. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  52560. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  52561. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  52562. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  52563. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  52564. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  52565. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  52566. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  52567. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  52568. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  52569. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  52570. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  52571. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  52572. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  52573. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  52574. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  52575. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  52576. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  52577. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  52578. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  52579. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  52580. -----END CERTIFICATE-----
  52581. ACCVRAIZ1
  52582. =========
  52583. -----BEGIN CERTIFICATE-----
  52584. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  52585. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  52586. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  52587. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  52588. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  52589. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  52590. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  52591. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  52592. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  52593. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  52594. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  52595. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  52596. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  52597. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  52598. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  52599. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  52600. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  52601. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  52602. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  52603. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  52604. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  52605. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  52606. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  52607. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  52608. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  52609. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  52610. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  52611. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  52612. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  52613. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  52614. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  52615. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  52616. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  52617. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  52618. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  52619. EfbRD0tVNEYqi4Y7
  52620. -----END CERTIFICATE-----
  52621. TWCA Global Root CA
  52622. ===================
  52623. -----BEGIN CERTIFICATE-----
  52624. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  52625. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  52626. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  52627. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  52628. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  52629. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  52630. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  52631. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  52632. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  52633. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  52634. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  52635. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  52636. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  52637. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  52638. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  52639. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  52640. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  52641. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  52642. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  52643. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  52644. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  52645. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  52646. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  52647. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  52648. -----END CERTIFICATE-----
  52649. TeliaSonera Root CA v1
  52650. ======================
  52651. -----BEGIN CERTIFICATE-----
  52652. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  52653. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  52654. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  52655. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  52656. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  52657. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  52658. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  52659. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  52660. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  52661. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  52662. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  52663. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  52664. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  52665. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  52666. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  52667. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  52668. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  52669. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  52670. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  52671. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  52672. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  52673. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  52674. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  52675. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  52676. -----END CERTIFICATE-----
  52677. E-Tugra Certification Authority
  52678. ===============================
  52679. -----BEGIN CERTIFICATE-----
  52680. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  52681. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  52682. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  52683. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  52684. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  52685. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  52686. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  52687. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  52688. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  52689. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  52690. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  52691. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  52692. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  52693. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  52694. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  52695. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  52696. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  52697. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  52698. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  52699. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  52700. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  52701. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  52702. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  52703. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  52704. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  52705. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  52706. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  52707. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  52708. C7TbO6Orb1wdtn7os4I07QZcJA==
  52709. -----END CERTIFICATE-----
  52710. T-TeleSec GlobalRoot Class 2
  52711. ============================
  52712. -----BEGIN CERTIFICATE-----
  52713. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  52714. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  52715. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  52716. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  52717. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  52718. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  52719. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  52720. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  52721. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  52722. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  52723. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  52724. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  52725. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  52726. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  52727. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  52728. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  52729. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  52730. -----END CERTIFICATE-----
  52731. Atos TrustedRoot 2011
  52732. =====================
  52733. -----BEGIN CERTIFICATE-----
  52734. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  52735. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  52736. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  52737. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  52738. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  52739. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  52740. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  52741. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  52742. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  52743. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  52744. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  52745. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  52746. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  52747. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  52748. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  52749. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  52750. -----END CERTIFICATE-----
  52751. QuoVadis Root CA 1 G3
  52752. =====================
  52753. -----BEGIN CERTIFICATE-----
  52754. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  52755. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  52756. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  52757. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  52758. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  52759. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  52760. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  52761. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  52762. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  52763. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  52764. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  52765. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  52766. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  52767. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52768. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  52769. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  52770. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  52771. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  52772. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  52773. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  52774. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  52775. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  52776. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  52777. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  52778. hMJKzRwuJIczYOXD
  52779. -----END CERTIFICATE-----
  52780. QuoVadis Root CA 2 G3
  52781. =====================
  52782. -----BEGIN CERTIFICATE-----
  52783. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  52784. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  52785. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  52786. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  52787. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  52788. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  52789. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  52790. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  52791. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  52792. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  52793. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  52794. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  52795. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  52796. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52797. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  52798. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  52799. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  52800. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  52801. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  52802. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  52803. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  52804. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  52805. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  52806. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  52807. O3jtZsSOeWmD3n+M
  52808. -----END CERTIFICATE-----
  52809. QuoVadis Root CA 3 G3
  52810. =====================
  52811. -----BEGIN CERTIFICATE-----
  52812. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  52813. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  52814. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  52815. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  52816. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  52817. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  52818. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  52819. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  52820. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  52821. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  52822. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  52823. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  52824. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  52825. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52826. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  52827. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  52828. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  52829. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  52830. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  52831. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  52832. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  52833. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  52834. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  52835. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  52836. PpxxVJkES/1Y+Zj0
  52837. -----END CERTIFICATE-----
  52838. DigiCert Assured ID Root G2
  52839. ===========================
  52840. -----BEGIN CERTIFICATE-----
  52841. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  52842. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  52843. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  52844. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  52845. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  52846. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  52847. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  52848. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  52849. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  52850. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  52851. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  52852. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  52853. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  52854. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  52855. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  52856. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  52857. IhNzbM8m9Yop5w==
  52858. -----END CERTIFICATE-----
  52859. DigiCert Assured ID Root G3
  52860. ===========================
  52861. -----BEGIN CERTIFICATE-----
  52862. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  52863. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  52864. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  52865. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  52866. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  52867. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  52868. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  52869. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  52870. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  52871. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  52872. 1vUhZscv6pZjamVFkpUBtA==
  52873. -----END CERTIFICATE-----
  52874. DigiCert Global Root G2
  52875. =======================
  52876. -----BEGIN CERTIFICATE-----
  52877. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  52878. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  52879. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  52880. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  52881. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  52882. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  52883. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  52884. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  52885. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  52886. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  52887. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  52888. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  52889. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  52890. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  52891. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  52892. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  52893. MrY=
  52894. -----END CERTIFICATE-----
  52895. DigiCert Global Root G3
  52896. =======================
  52897. -----BEGIN CERTIFICATE-----
  52898. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  52899. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  52900. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  52901. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  52902. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  52903. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  52904. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  52905. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  52906. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  52907. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  52908. VOKa5Vt8sycX
  52909. -----END CERTIFICATE-----
  52910. DigiCert Trusted Root G4
  52911. ========================
  52912. -----BEGIN CERTIFICATE-----
  52913. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  52914. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  52915. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  52916. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  52917. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  52918. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  52919. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  52920. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  52921. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  52922. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  52923. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  52924. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  52925. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  52926. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  52927. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  52928. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  52929. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  52930. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  52931. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  52932. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  52933. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  52934. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  52935. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  52936. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  52937. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  52938. 82Z+
  52939. -----END CERTIFICATE-----
  52940. WoSign
  52941. ======
  52942. -----BEGIN CERTIFICATE-----
  52943. MIIFdjCCA16gAwIBAgIQXmjWEXGUY1BWAGjzPsnFkTANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQG
  52944. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxKjAoBgNVBAMTIUNlcnRpZmljYXRpb24g
  52945. QXV0aG9yaXR5IG9mIFdvU2lnbjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMFUxCzAJ
  52946. BgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEqMCgGA1UEAxMhQ2VydGlmaWNh
  52947. dGlvbiBBdXRob3JpdHkgb2YgV29TaWduMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA
  52948. vcqNrLiRFVaXe2tcesLea9mhsMMQI/qnobLMMfo+2aYpbxY94Gv4uEBf2zmoAHqLoE1UfcIiePyO
  52949. CbiohdfMlZdLdNiefvAA5A6JrkkoRBoQmTIPJYhTpA2zDxIIFgsDcSccf+Hb0v1naMQFXQoOXXDX
  52950. 2JegvFNBmpGN9J42Znp+VsGQX+axaCA2pIwkLCxHC1l2ZjC1vt7tj/id07sBMOby8w7gLJKA84X5
  52951. KIq0VC6a7fd2/BVoFutKbOsuEo/Uz/4Mx1wdC34FMr5esAkqQtXJTpCzWQ27en7N1QhatH/YHGkR
  52952. +ScPewavVIMYe+HdVHpRaG53/Ma/UkpmRqGyZxq7o093oL5d//xWC0Nyd5DKnvnyOfUNqfTq1+ez
  52953. EC8wQjchzDBwyYaYD8xYTYO7feUapTeNtqwylwA6Y3EkHp43xP901DfA4v6IRmAR3Qg/UDaruHqk
  52954. lWJqbrDKaiFaafPz+x1wOZXzp26mgYmhiMU7ccqjUu6Du/2gd/Tkb+dC221KmYo0SLwX3OSACCK2
  52955. 8jHAPwQ+658geda4BmRkAjHXqc1S+4RFaQkAKtxVi8QGRkvASh0JWzko/amrzgD5LkhLJuYwTKVY
  52956. yrREgk/nkR4zw7CT/xH8gdLKH3Ep3XZPkiWvHYG3Dy+MwwbMLyejSuQOmbp8HkUff6oZRZb9/D0C
  52957. AwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFOFmzw7R
  52958. 8bNLtwYgFP6HEtX2/vs+MA0GCSqGSIb3DQEBBQUAA4ICAQCoy3JAsnbBfnv8rWTjMnvMPLZdRtP1
  52959. LOJwXcgu2AZ9mNELIaCJWSQBnfmvCX0KI4I01fx8cpm5o9dU9OpScA7F9dY74ToJMuYhOZO9sxXq
  52960. T2r09Ys/L3yNWC7F4TmgPsc9SnOeQHrAK2GpZ8nzJLmzbVUsWh2eJXLOC62qx1ViC777Y7NhRCOj
  52961. y+EaDveaBk3e1CNOIZZbOVtXHS9dCF4Jef98l7VNg64N1uajeeAz0JmWAjCnPv/So0M/BVoG6kQC
  52962. 2nz4SNAzqfkHx5Xh9T71XXG68pWpdIhhWeO/yloTunK0jF02h+mmxTwTv97QRCbut+wucPrXnbes
  52963. 5cVAWubXbHssw1abR80LzvobtCHXt2a49CUwi1wNuepnsvRtrtWhnk/Yn+knArAdBtaP4/tIEp9/
  52964. EaEQPkxROpaw0RPxx9gmrjrKkcRpnd8BKWRRb2jaFOwIQZeQjdCygPLPwj2/kWjFgGcexGATVdVh
  52965. mVd8upUPYUk6ynW8yQqTP2cOEvIo4jEbwFcW3wh8GcF+Dx+FHgo2fFt+J7x6v+Db9NpSvd4MVHAx
  52966. kUOVyLzwPt0JfjBkUO1/AaQzZ01oT74V77D2AhGiGxMlOtzCWfHjXEa7ZywCRuoeSKbmW9m1vFGi
  52967. kpbbqsY3Iqb+zCB0oy2pLmvLwIIRIbWTee5Ehr7XHuQe+w==
  52968. -----END CERTIFICATE-----
  52969. WoSign China
  52970. ============
  52971. -----BEGIN CERTIFICATE-----
  52972. MIIFWDCCA0CgAwIBAgIQUHBrzdgT/BtOOzNy0hFIjTANBgkqhkiG9w0BAQsFADBGMQswCQYDVQQG
  52973. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMMEkNBIOayg+mAmuagueiv
  52974. geS5pjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMEYxCzAJBgNVBAYTAkNOMRowGAYD
  52975. VQQKExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAwwSQ0Eg5rKD6YCa5qC56K+B5LmmMIICIjAN
  52976. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0EkhHiX8h8EqwqzbdoYGTufQdDTc7WU1/FDWiD+k
  52977. 8H/rD195L4mx/bxjWDeTmzj4t1up+thxx7S8gJeNbEvxUNUqKaqoGXqW5pWOdO2XCld19AXbbQs5
  52978. uQF/qvbW2mzmBeCkTVL829B0txGMe41P/4eDrv8FAxNXUDf+jJZSEExfv5RxadmWPgxDT74wwJ85
  52979. dE8GRV2j1lY5aAfMh09Qd5Nx2UQIsYo06Yms25tO4dnkUkWMLhQfkWsZHWgpLFbE4h4TV2TwYeO5
  52980. Ed+w4VegG63XX9Gv2ystP9Bojg/qnw+LNVgbExz03jWhCl3W6t8Sb8D7aQdGctyB9gQjF+BNdeFy
  52981. b7Ao65vh4YOhn0pdr8yb+gIgthhid5E7o9Vlrdx8kHccREGkSovrlXLp9glk3Kgtn3R46MGiCWOc
  52982. 76DbT52VqyBPt7D3h1ymoOQ3OMdc4zUPLK2jgKLsLl3Az+2LBcLmc272idX10kaO6m1jGx6KyX2m
  52983. +Jzr5dVjhU1zZmkR/sgO9MHHZklTfuQZa/HpelmjbX7FF+Ynxu8b22/8DU0GAbQOXDBGVWCvOGU6
  52984. yke6rCzMRh+yRpY/8+0mBe53oWprfi1tWFxK1I5nuPHa1UaKJ/kR8slC/k7e3x9cxKSGhxYzoacX
  52985. GKUN5AXlK8IrC6KVkLn9YDxOiT7nnO4fuwECAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1Ud
  52986. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFOBNv9ybQV0T6GTwp+kVpOGBwboxMA0GCSqGSIb3DQEBCwUA
  52987. A4ICAQBqinA4WbbaixjIvirTthnVZil6Xc1bL3McJk6jfW+rtylNpumlEYOnOXOvEESS5iVdT2H6
  52988. yAa+Tkvv/vMx/sZ8cApBWNromUuWyXi8mHwCKe0JgOYKOoICKuLJL8hWGSbueBwj/feTZU7n85iY
  52989. r83d2Z5AiDEoOqsuC7CsDCT6eiaY8xJhEPRdF/d+4niXVOKM6Cm6jBAyvd0zaziGfjk9DgNyp115
  52990. j0WKWa5bIW4xRtVZjc8VX90xJc/bYNaBRHIpAlf2ltTW/+op2znFuCyKGo3Oy+dCMYYFaA6eFN0A
  52991. kLppRQjbbpCBhqcqBT/mhDn4t/lXX0ykeVoQDF7Va/81XwVRHmyjdanPUIPTfPRm94KNPQx96N97
  52992. qA4bLJyuQHCH2u2nFoJavjVsIE4iYdm8UXrNemHcSxH5/mc0zy4EZmFcV5cjjPOGG0jfKq+nwf/Y
  52993. jj4Du9gqsPoUJbJRa4ZDhS4HIxaAjUz7tGM7zMN07RujHv41D198HRaG9Q7DlfEvr10lO1Hm13ZB
  52994. ONFLAzkopR6RctR9q5czxNM+4Gm2KHmgCY0c0f9BckgG/Jou5yD5m6Leie2uPAmvylezkolwQOQv
  52995. T8Jwg0DXJCxr5wkf09XHwQj02w47HAcLQxGEIYbpgNR12KvxAmLBsX5VYc8T1yaw15zLKYs4SgsO
  52996. kI26oQ==
  52997. -----END CERTIFICATE-----
  52998. COMODO RSA Certification Authority
  52999. ==================================
  53000. -----BEGIN CERTIFICATE-----
  53001. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  53002. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  53003. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  53004. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  53005. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  53006. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  53007. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  53008. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  53009. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  53010. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  53011. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  53012. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  53013. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  53014. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  53015. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  53016. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  53017. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  53018. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  53019. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  53020. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  53021. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  53022. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  53023. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  53024. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  53025. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  53026. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  53027. LaZRfyHBNVOFBkpdn627G190
  53028. -----END CERTIFICATE-----
  53029. USERTrust RSA Certification Authority
  53030. =====================================
  53031. -----BEGIN CERTIFICATE-----
  53032. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  53033. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  53034. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  53035. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  53036. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  53037. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  53038. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  53039. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  53040. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  53041. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  53042. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  53043. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  53044. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  53045. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  53046. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  53047. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  53048. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  53049. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  53050. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  53051. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  53052. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  53053. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  53054. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  53055. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  53056. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  53057. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  53058. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  53059. -----END CERTIFICATE-----
  53060. USERTrust ECC Certification Authority
  53061. =====================================
  53062. -----BEGIN CERTIFICATE-----
  53063. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  53064. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  53065. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  53066. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  53067. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  53068. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  53069. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  53070. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  53071. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  53072. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  53073. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  53074. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  53075. -----END CERTIFICATE-----
  53076. GlobalSign ECC Root CA - R4
  53077. ===========================
  53078. -----BEGIN CERTIFICATE-----
  53079. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  53080. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53081. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  53082. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53083. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  53084. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  53085. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  53086. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  53087. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  53088. -----END CERTIFICATE-----
  53089. GlobalSign ECC Root CA - R5
  53090. ===========================
  53091. -----BEGIN CERTIFICATE-----
  53092. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  53093. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53094. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  53095. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53096. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  53097. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  53098. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  53099. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  53100. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  53101. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  53102. -----END CERTIFICATE-----
  53103. Staat der Nederlanden Root CA - G3
  53104. ==================================
  53105. -----BEGIN CERTIFICATE-----
  53106. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53107. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53108. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  53109. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  53110. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  53111. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  53112. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  53113. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  53114. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  53115. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  53116. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  53117. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  53118. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  53119. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  53120. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  53121. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  53122. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  53123. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  53124. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  53125. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  53126. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  53127. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  53128. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  53129. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  53130. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  53131. -----END CERTIFICATE-----
  53132. Staat der Nederlanden EV Root CA
  53133. ================================
  53134. -----BEGIN CERTIFICATE-----
  53135. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53136. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53137. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  53138. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  53139. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  53140. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  53141. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  53142. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  53143. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  53144. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  53145. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  53146. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  53147. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  53148. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  53149. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  53150. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  53151. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  53152. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  53153. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  53154. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  53155. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  53156. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  53157. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  53158. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  53159. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  53160. -----END CERTIFICATE-----
  53161. IdenTrust Commercial Root CA 1
  53162. ==============================
  53163. -----BEGIN CERTIFICATE-----
  53164. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  53165. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  53166. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  53167. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  53168. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  53169. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  53170. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  53171. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  53172. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  53173. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  53174. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  53175. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  53176. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  53177. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  53178. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  53179. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  53180. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  53181. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  53182. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  53183. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  53184. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  53185. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  53186. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  53187. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  53188. cGzM7vRX+Bi6hG6H
  53189. -----END CERTIFICATE-----
  53190. IdenTrust Public Sector Root CA 1
  53191. =================================
  53192. -----BEGIN CERTIFICATE-----
  53193. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  53194. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  53195. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  53196. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  53197. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  53198. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  53199. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  53200. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  53201. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  53202. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  53203. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  53204. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  53205. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  53206. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  53207. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  53208. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  53209. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  53210. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  53211. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  53212. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  53213. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  53214. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  53215. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  53216. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  53217. 3Wl9af0AVqW3rLatt8o+Ae+c
  53218. -----END CERTIFICATE-----
  53219. Entrust Root Certification Authority - G2
  53220. =========================================
  53221. -----BEGIN CERTIFICATE-----
  53222. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  53223. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  53224. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  53225. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  53226. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  53227. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  53228. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  53229. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  53230. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  53231. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  53232. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  53233. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  53234. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  53235. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  53236. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  53237. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  53238. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  53239. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  53240. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  53241. e4pIb4tF9g==
  53242. -----END CERTIFICATE-----
  53243. Entrust Root Certification Authority - EC1
  53244. ==========================================
  53245. -----BEGIN CERTIFICATE-----
  53246. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  53247. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  53248. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  53249. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  53250. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  53251. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  53252. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  53253. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  53254. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  53255. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  53256. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  53257. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  53258. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  53259. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  53260. -----END CERTIFICATE-----
  53261. CFCA EV ROOT
  53262. ============
  53263. -----BEGIN CERTIFICATE-----
  53264. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  53265. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  53266. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  53267. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  53268. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  53269. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  53270. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  53271. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  53272. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  53273. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  53274. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  53275. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  53276. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  53277. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  53278. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  53279. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  53280. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  53281. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  53282. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  53283. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  53284. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  53285. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  53286. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  53287. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  53288. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  53289. -----END CERTIFICATE-----
  53290. TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5
  53291. ====================================================
  53292. -----BEGIN CERTIFICATE-----
  53293. MIIEJzCCAw+gAwIBAgIHAI4X/iQggTANBgkqhkiG9w0BAQsFADCBsTELMAkGA1UEBhMCVFIxDzAN
  53294. BgNVBAcMBkFua2FyYTFNMEsGA1UECgxEVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  53295. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4xQjBABgNVBAMMOVTDnFJLVFJVU1Qg
  53296. RWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSBINTAeFw0xMzA0MzAw
  53297. ODA3MDFaFw0yMzA0MjgwODA3MDFaMIGxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMU0w
  53298. SwYDVQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnE
  53299. n2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBFbGVrdHJvbmlrIFNlcnRp
  53300. ZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg1MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  53301. CgKCAQEApCUZ4WWe60ghUEoI5RHwWrom/4NZzkQqL/7hzmAD/I0Dpe3/a6i6zDQGn1k19uwsu537
  53302. jVJp45wnEFPzpALFp/kRGml1bsMdi9GYjZOHp3GXDSHHmflS0yxjXVW86B8BSLlg/kJK9siArs1m
  53303. ep5Fimh34khon6La8eHBEJ/rPCmBp+EyCNSgBbGM+42WAA4+Jd9ThiI7/PS98wl+d+yG6w8z5UNP
  53304. 9FR1bSmZLmZaQ9/LXMrI5Tjxfjs1nQ/0xVqhzPMggCTTV+wVunUlm+hkS7M0hO8EuPbJbKoCPrZV
  53305. 4jI3X/xml1/N1p7HIL9Nxqw/dV8c7TKcfGkAaZHjIxhT6QIDAQABo0IwQDAdBgNVHQ4EFgQUVpkH
  53306. HtOsDGlktAxQR95DLL4gwPswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI
  53307. hvcNAQELBQADggEBAJ5FdnsXSDLyOIspve6WSk6BGLFRRyDN0GSxDsnZAdkJzsiZ3GglE9Rc8qPo
  53308. BP5yCccLqh0lVX6Wmle3usURehnmp349hQ71+S4pL+f5bFgWV1Al9j4uPqrtd3GqqpmWRgqujuwq
  53309. URawXs3qZwQcWDD1YIq9pr1N5Za0/EKJAWv2cMhQOQwt1WbZyNKzMrcbGW3LM/nfpeYVhDfwwvJl
  53310. lpKQd/Ct9JDpEXjXk4nAPQu6KfTomZ1yju2dL+6SfaHx/126M2CFYv4HAqGEVka+lgqaE9chTLd8
  53311. B59OTj+RdPsnnRHM3eaxynFNExc5JsUpISuTKWqW+qtB4Uu2NQvAmxU=
  53312. -----END CERTIFICATE-----
  53313. Certinomis - Root CA
  53314. ====================
  53315. -----BEGIN CERTIFICATE-----
  53316. MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  53317. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
  53318. LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
  53319. EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
  53320. ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
  53321. P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
  53322. d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
  53323. z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
  53324. 8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
  53325. RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
  53326. 6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
  53327. FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV
  53328. PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH
  53329. i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj
  53330. YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I
  53331. 6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF
  53332. AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV
  53333. WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw
  53334. Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX
  53335. lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ
  53336. y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9
  53337. Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng
  53338. DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi
  53339. I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM
  53340. cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr
  53341. hkIGuUE=
  53342. -----END CERTIFICATE-----
  53343. OISTE WISeKey Global Root GB CA
  53344. ===============================
  53345. -----BEGIN CERTIFICATE-----
  53346. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  53347. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  53348. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  53349. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  53350. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  53351. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  53352. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  53353. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  53354. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  53355. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  53356. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  53357. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  53358. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  53359. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  53360. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  53361. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  53362. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  53363. -----END CERTIFICATE-----
  53364. Certification Authority of WoSign G2
  53365. ====================================
  53366. -----BEGIN CERTIFICATE-----
  53367. MIIDfDCCAmSgAwIBAgIQayXaioidfLwPBbOxemFFRDANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQG
  53368. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxLTArBgNVBAMTJENlcnRpZmljYXRpb24g
  53369. QXV0aG9yaXR5IG9mIFdvU2lnbiBHMjAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMFgx
  53370. CzAJBgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEtMCsGA1UEAxMkQ2VydGlm
  53371. aWNhdGlvbiBBdXRob3JpdHkgb2YgV29TaWduIEcyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  53372. CgKCAQEAvsXEoCKASU+/2YcRxlPhuw+9YH+v9oIOH9ywjj2X4FA8jzrvZjtFB5sg+OPXJYY1kBai
  53373. XW8wGQiHC38Gsp1ij96vkqVg1CuAmlI/9ZqD6TRay9nVYlzmDuDfBpgOgHzKtB0TiGsOqCR3A9Du
  53374. W/PKaZE1OVbFbeP3PU9ekzgkyhjpJMuSA93MHD0JcOQg5PGurLtzaaNjOg9FD6FKmsLRY6zLEPg9
  53375. 5k4ot+vElbGs/V6r+kHLXZ1L3PR8du9nfwB6jdKgGlxNIuG12t12s9R23164i5jIFFTMaxeSt+BK
  53376. v0mUYQs4kI9dJGwlezt52eJ+na2fmKEG/HgUYFf47oB3sQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  53377. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU+mCp62XF3RYUCE4MD42b4Pdkr2cwDQYJKoZI
  53378. hvcNAQELBQADggEBAFfDejaCnI2Y4qtAqkePx6db7XznPWZaOzG73/MWM5H8fHulwqZm46qwtyeY
  53379. P0nXYGdnPzZPSsvxFPpahygc7Y9BMsaV+X3avXtbwrAh449G3CE4Q3RM+zD4F3LBMvzIkRfEzFg3
  53380. TgvMWvchNSiDbGAtROtSjFA9tWwS1/oJu2yySrHFieT801LYYRf+epSEj3m2M1m6D8QL4nCgS3gu
  53381. +sif/a+RZQp4OBXllxcU3fngLDT4ONCEIgDAFFEYKwLcMFrw6AF8NTojrwjkr6qOKEJJLvD1mTS+
  53382. 7Q9LGOHSJDy7XUe3IfKN0QqZjuNuPq1w4I+5ysxugTH2e5x6eeRncRg=
  53383. -----END CERTIFICATE-----
  53384. CA WoSign ECC Root
  53385. ==================
  53386. -----BEGIN CERTIFICATE-----
  53387. MIICCTCCAY+gAwIBAgIQaEpYcIBr8I8C+vbe6LCQkDAKBggqhkjOPQQDAzBGMQswCQYDVQQGEwJD
  53388. TjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMTEkNBIFdvU2lnbiBFQ0MgUm9v
  53389. dDAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMEYxCzAJBgNVBAYTAkNOMRowGAYDVQQK
  53390. ExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAxMSQ0EgV29TaWduIEVDQyBSb290MHYwEAYHKoZI
  53391. zj0CAQYFK4EEACIDYgAE4f2OuEMkq5Z7hcK6C62N4DrjJLnSsb6IOsq/Srj57ywvr1FQPEd1bPiU
  53392. t5v8KB7FVMxjnRZLU8HnIKvNrCXSf4/CwVqCXjCLelTOA7WRf6qU0NGKSMyCBSah1VES1ns2o0Iw
  53393. QDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUqv3VWqP2h4syhf3R
  53394. MluARZPzA7gwCgYIKoZIzj0EAwMDaAAwZQIxAOSkhLCB1T2wdKyUpOgOPQB0TKGXa/kNUTyh2Tv0
  53395. Daupn75OcsqF1NnstTJFGG+rrQIwfcf3aWMvoeGY7xMQ0Xk/0f7qO3/eVvSQsRUR2LIiFdAvwyYu
  53396. a/GRspBl9JrmkO5K
  53397. -----END CERTIFICATE-----
  53398. SZAFIR ROOT CA2
  53399. ===============
  53400. -----BEGIN CERTIFICATE-----
  53401. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  53402. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  53403. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  53404. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  53405. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  53406. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  53407. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  53408. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  53409. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  53410. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  53411. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  53412. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  53413. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  53414. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  53415. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  53416. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  53417. -----END CERTIFICATE-----
  53418. Certum Trusted Network CA 2
  53419. ===========================
  53420. -----BEGIN CERTIFICATE-----
  53421. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  53422. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  53423. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  53424. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  53425. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  53426. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  53427. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  53428. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  53429. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  53430. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  53431. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  53432. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  53433. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  53434. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  53435. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  53436. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53437. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  53438. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  53439. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  53440. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  53441. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  53442. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  53443. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  53444. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  53445. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  53446. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  53447. zAYspsbiDrW5viSP
  53448. -----END CERTIFICATE-----
  53449. Hellenic Academic and Research Institutions RootCA 2015
  53450. =======================================================
  53451. -----BEGIN CERTIFICATE-----
  53452. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  53453. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  53454. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  53455. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  53456. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  53457. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  53458. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  53459. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  53460. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  53461. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  53462. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  53463. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  53464. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  53465. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  53466. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  53467. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  53468. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53469. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  53470. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  53471. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  53472. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  53473. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  53474. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  53475. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  53476. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  53477. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  53478. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  53479. p/UsQu0yrbYhnr68
  53480. -----END CERTIFICATE-----
  53481. Hellenic Academic and Research Institutions ECC RootCA 2015
  53482. ===========================================================
  53483. -----BEGIN CERTIFICATE-----
  53484. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  53485. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  53486. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  53487. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  53488. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  53489. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  53490. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  53491. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  53492. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  53493. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  53494. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  53495. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  53496. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  53497. -----END CERTIFICATE-----
  53498. Certplus Root CA G1
  53499. ===================
  53500. -----BEGIN CERTIFICATE-----
  53501. MIIFazCCA1OgAwIBAgISESBVg+QtPlRWhS2DN7cs3EYRMA0GCSqGSIb3DQEBDQUAMD4xCzAJBgNV
  53502. BAYTAkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTAe
  53503. Fw0xNDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhD
  53504. ZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTCCAiIwDQYJKoZIhvcNAQEBBQAD
  53505. ggIPADCCAgoCggIBANpQh7bauKk+nWT6VjOaVj0W5QOVsjQcmm1iBdTYj+eJZJ+622SLZOZ5KmHN
  53506. r49aiZFluVj8tANfkT8tEBXgfs+8/H9DZ6itXjYj2JizTfNDnjl8KvzsiNWI7nC9hRYt6kuJPKNx
  53507. Qv4c/dMcLRC4hlTqQ7jbxofaqK6AJc96Jh2qkbBIb6613p7Y1/oA/caP0FG7Yn2ksYyy/yARujVj
  53508. BYZHYEMzkPZHogNPlk2dT8Hq6pyi/jQu3rfKG3akt62f6ajUeD94/vI4CTYd0hYCyOwqaK/1jpTv
  53509. LRN6HkJKHRUxrgwEV/xhc/MxVoYxgKDEEW4wduOU8F8ExKyHcomYxZ3MVwia9Az8fXoFOvpHgDm2
  53510. z4QTd28n6v+WZxcIbekN1iNQMLAVdBM+5S//Ds3EC0pd8NgAM0lm66EYfFkuPSi5YXHLtaW6uOrc
  53511. 4nBvCGrch2c0798wct3zyT8j/zXhviEpIDCB5BmlIOklynMxdCm+4kLV87ImZsdo/Rmz5yCTmehd
  53512. 4F6H50boJZwKKSTUzViGUkAksnsPmBIgJPaQbEfIDbsYIC7Z/fyL8inqh3SV4EJQeIQEQWGw9CEj
  53513. jy3LKCHyamz0GqbFFLQ3ZU+V/YDI+HLlJWvEYLF7bY5KinPOWftwenMGE9nTdDckQQoRb5fc5+R+
  53514. ob0V8rqHDz1oihYHAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0G
  53515. A1UdDgQWBBSowcCbkahDFXxdBie0KlHYlwuBsTAfBgNVHSMEGDAWgBSowcCbkahDFXxdBie0KlHY
  53516. lwuBsTANBgkqhkiG9w0BAQ0FAAOCAgEAnFZvAX7RvUz1isbwJh/k4DgYzDLDKTudQSk0YcbX8ACh
  53517. 66Ryj5QXvBMsdbRX7gp8CXrc1cqh0DQT+Hern+X+2B50ioUHj3/MeXrKls3N/U/7/SMNkPX0XtPG
  53518. YX2eEeAC7gkE2Qfdpoq3DIMku4NQkv5gdRE+2J2winq14J2by5BSS7CTKtQ+FjPlnsZlFT5kOwQ/
  53519. 2wyPX1wdaR+v8+khjPPvl/aatxm2hHSco1S1cE5j2FddUyGbQJJD+tZ3VTNPZNX70Cxqjm0lpu+F
  53520. 6ALEUz65noe8zDUa3qHpimOHZR4RKttjd5cUvpoUmRGywO6wT/gUITJDT5+rosuoD6o7BlXGEilX
  53521. CNQ314cnrUlZp5GrRHpejXDbl85IULFzk/bwg2D5zfHhMf1bfHEhYxQUqq/F3pN+aLHsIqKqkHWe
  53522. tUNy6mSjhEv9DKgma3GX7lZjZuhCVPnHHd/Qj1vfyDBviP4NxDMcU6ij/UgQ8uQKTuEVV/xuZDDC
  53523. VRHc6qnNSlSsKWNEz0pAoNZoWRsz+e86i9sgktxChL8Bq4fA1SCC28a5g4VCXA9DO2pJNdWY9BW/
  53524. +mGBDAkgGNLQFwzLSABQ6XaCjGTXOqAHVcweMcDvOrRl++O/QmueD6i9a5jc2NvLi6Td11n0bt3+
  53525. qsOR0C5CB8AMTVPNJLFMWx5R9N/pkvo=
  53526. -----END CERTIFICATE-----
  53527. Certplus Root CA G2
  53528. ===================
  53529. -----BEGIN CERTIFICATE-----
  53530. MIICHDCCAaKgAwIBAgISESDZkc6uo+jF5//pAq/Pc7xVMAoGCCqGSM49BAMDMD4xCzAJBgNVBAYT
  53531. AkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjAeFw0x
  53532. NDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhDZXJ0
  53533. cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  53534. BM0PW1aC3/BFGtat93nwHcmsltaeTpwftEIRyoa/bfuFo8XlGVzX7qY/aWfYeOKmycTbLXku54uN
  53535. Am8xIk0G42ByRZ0OQneezs/lf4WbGOT8zC5y0xaTTsqZY1yhBSpsBqNjMGEwDgYDVR0PAQH/BAQD
  53536. AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMB8GA1Ud
  53537. IwQYMBaAFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMAoGCCqGSM49BAMDA2gAMGUCMHD+sAvZ94OX7PNV
  53538. HdTcswYO/jOYnYs5kGuUIe22113WTNchp+e/IQ8rzfcq3IUHnQIxAIYUFuXcsGXCwI4Un78kFmjl
  53539. vPl5adytRSv3tjFzzAalU5ORGpOucGpnutee5WEaXw==
  53540. -----END CERTIFICATE-----
  53541. OpenTrust Root CA G1
  53542. ====================
  53543. -----BEGIN CERTIFICATE-----
  53544. MIIFbzCCA1egAwIBAgISESCzkFU5fX82bWTCp59rY45nMA0GCSqGSIb3DQEBCwUAMEAxCzAJBgNV
  53545. BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcx
  53546. MB4XDTE0MDUyNjA4NDU1MFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
  53547. CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzEwggIiMA0GCSqGSIb3DQEB
  53548. AQUAA4ICDwAwggIKAoICAQD4eUbalsUwXopxAy1wpLuwxQjczeY1wICkES3d5oeuXT2R0odsN7fa
  53549. Yp6bwiTXj/HbpqbfRm9RpnHLPhsxZ2L3EVs0J9V5ToybWL0iEA1cJwzdMOWo010hOHQX/uMftk87
  53550. ay3bfWAfjH1MBcLrARYVmBSO0ZB3Ij/swjm4eTrwSSTilZHcYTSSjFR077F9jAHiOH3BX2pfJLKO
  53551. YheteSCtqx234LSWSE9mQxAGFiQD4eCcjsZGT44ameGPuY4zbGneWK2gDqdkVBFpRGZPTBKnjix9
  53552. xNRbxQA0MMHZmf4yzgeEtE7NCv82TWLxp2NX5Ntqp66/K7nJ5rInieV+mhxNaMbBGN4zK1FGSxyO
  53553. 9z0M+Yo0FMT7MzUj8czxKselu7Cizv5Ta01BG2Yospb6p64KTrk5M0ScdMGTHPjgniQlQ/GbI4Kq
  53554. 3ywgsNw2TgOzfALU5nsaqocTvz6hdLubDuHAk5/XpGbKuxs74zD0M1mKB3IDVedzagMxbm+WG+Oi
  53555. n6+Sx+31QrclTDsTBM8clq8cIqPQqwWyTBIjUtz9GVsnnB47ev1CI9sjgBPwvFEVVJSmdz7QdFG9
  53556. URQIOTfLHzSpMJ1ShC5VkLG631UAC9hWLbFJSXKAqWLXwPYYEQRVzXR7z2FwefR7LFxckvzluFqr
  53557. TJOVoSfupb7PcSNCupt2LQIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  53558. /zAdBgNVHQ4EFgQUl0YhVyE12jZVx/PxN3DlCPaTKbYwHwYDVR0jBBgwFoAUl0YhVyE12jZVx/Px
  53559. N3DlCPaTKbYwDQYJKoZIhvcNAQELBQADggIBAB3dAmB84DWn5ph76kTOZ0BP8pNuZtQ5iSas000E
  53560. PLuHIT839HEl2ku6q5aCgZG27dmxpGWX4m9kWaSW7mDKHyP7Rbr/jyTwyqkxf3kfgLMtMrpkZ2Cv
  53561. uVnN35pJ06iCsfmYlIrM4LvgBBuZYLFGZdwIorJGnkSI6pN+VxbSFXJfLkur1J1juONI5f6ELlgK
  53562. n0Md/rcYkoZDSw6cMoYsYPXpSOqV7XAp8dUv/TW0V8/bhUiZucJvbI/NeJWsZCj9VrDDb8O+WVLh
  53563. X4SPgPL0DTatdrOjteFkdjpY3H1PXlZs5VVZV6Xf8YpmMIzUUmI4d7S+KNfKNsSbBfD4Fdvb8e80
  53564. nR14SohWZ25g/4/Ii+GOvUKpMwpZQhISKvqxnUOOBZuZ2mKtVzazHbYNeS2WuOvyDEsMpZTGMKcm
  53565. GS3tTAZQMPH9WD25SxdfGbRqhFS0OE85og2WaMMolP3tLR9Ka0OWLpABEPs4poEL0L9109S5zvE/
  53566. bw4cHjdx5RiHdRk/ULlepEU0rbDK5uUTdg8xFKmOLZTW1YVNcxVPS/KyPu1svf0OnWZzsD2097+o
  53567. 4BGkxK51CUpjAEggpsadCwmKtODmzj7HPiY46SvepghJAwSQiumPv+i2tCqjI40cHLI5kqiPAlxA
  53568. OXXUc0ECd97N4EOH1uS6SsNsEn/+KuYj1oxx
  53569. -----END CERTIFICATE-----
  53570. OpenTrust Root CA G2
  53571. ====================
  53572. -----BEGIN CERTIFICATE-----
  53573. MIIFbzCCA1egAwIBAgISESChaRu/vbm9UpaPI+hIvyYRMA0GCSqGSIb3DQEBDQUAMEAxCzAJBgNV
  53574. BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcy
  53575. MB4XDTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
  53576. CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzIwggIiMA0GCSqGSIb3DQEB
  53577. AQUAA4ICDwAwggIKAoICAQDMtlelM5QQgTJT32F+D3Y5z1zCU3UdSXqWON2ic2rxb95eolq5cSG+
  53578. Ntmh/LzubKh8NBpxGuga2F8ORAbtp+Dz0mEL4DKiltE48MLaARf85KxP6O6JHnSrT78eCbY2albz
  53579. 4e6WiWYkBuTNQjpK3eCasMSCRbP+yatcfD7J6xcvDH1urqWPyKwlCm/61UWY0jUJ9gNDlP7ZvyCV
  53580. eYCYitmJNbtRG6Q3ffyZO6v/v6wNj0OxmXsWEH4db0fEFY8ElggGQgT4hNYdvJGmQr5J1WqIP7wt
  53581. UdGejeBSzFfdNTVY27SPJIjki9/ca1TSgSuyzpJLHB9G+h3Ykst2Z7UJmQnlrBcUVXDGPKBWCgOz
  53582. 3GIZ38i1MH/1PCZ1Eb3XG7OHngevZXHloM8apwkQHZOJZlvoPGIytbU6bumFAYueQ4xncyhZW+vj
  53583. 3CzMpSZyYhK05pyDRPZRpOLAeiRXyg6lPzq1O4vldu5w5pLeFlwoW5cZJ5L+epJUzpM5ChaHvGOz
  53584. 9bGTXOBut9Dq+WIyiET7vycotjCVXRIouZW+j1MY5aIYFuJWpLIsEPUdN6b4t/bQWVyJ98LVtZR0
  53585. 0dX+G7bw5tYee9I8y6jj9RjzIR9u701oBnstXW5DiabA+aC/gh7PU3+06yzbXfZqfUAkBXKJOAGT
  53586. y3HCOV0GEfZvePg3DTmEJwIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  53587. /zAdBgNVHQ4EFgQUajn6QiL35okATV59M4PLuG53hq8wHwYDVR0jBBgwFoAUajn6QiL35okATV59
  53588. M4PLuG53hq8wDQYJKoZIhvcNAQENBQADggIBAJjLq0A85TMCl38th6aP1F5Kr7ge57tx+4BkJamz
  53589. Gj5oXScmp7oq4fBXgwpkTx4idBvpkF/wrM//T2h6OKQQbA2xx6R3gBi2oihEdqc0nXGEL8pZ0keI
  53590. mUEiyTCYYW49qKgFbdEfwFFEVn8nNQLdXpgKQuswv42hm1GqO+qTRmTFAHneIWv2V6CG1wZy7HBG
  53591. S4tz3aAhdT7cHcCP009zHIXZ/n9iyJVvttN7jLpTwm+bREx50B1ws9efAvSyB7DH5fitIw6mVskp
  53592. EndI2S9G/Tvw/HRwkqWOOAgfZDC2t0v7NqwQjqBSM2OdAzVWxWm9xiNaJ5T2pBL4LTM8oValX9YZ
  53593. 6e18CL13zSdkzJTaTkZQh+D5wVOAHrut+0dSixv9ovneDiK3PTNZbNTe9ZUGMg1RGUFcPk8G97kr
  53594. gCf2o6p6fAbhQ8MTOWIaNr3gKC6UAuQpLmBVrkA9sHSSXvAgZJY/X0VdiLWK2gKgW0VU3jg9CcCo
  53595. SmVGFvyqv1ROTVu+OEO3KMqLM6oaJbolXCkvW0pujOotnCr2BXbgd5eAiN1nE28daCSLT7d0geX0
  53596. YJ96Vdc+N9oWaz53rK4YcJUIeSkDiv7BO7M/Gg+kO14fWKGVyasvc0rQLW6aWQ9VGHgtPFGml4vm
  53597. u7JwqkwR3v98KzfUetF3NI/n+UL3PIEMS1IK
  53598. -----END CERTIFICATE-----
  53599. OpenTrust Root CA G3
  53600. ====================
  53601. -----BEGIN CERTIFICATE-----
  53602. MIICITCCAaagAwIBAgISESDm+Ez8JLC+BUCs2oMbNGA/MAoGCCqGSM49BAMDMEAxCzAJBgNVBAYT
  53603. AkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEczMB4X
  53604. DTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCU9w
  53605. ZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzMwdjAQBgcqhkjOPQIBBgUrgQQA
  53606. IgNiAARK7liuTcpm3gY6oxH84Bjwbhy6LTAMidnW7ptzg6kjFYwvWYpa3RTqnVkrQ7cG7DK2uu5B
  53607. ta1doYXM6h0UZqNnfkbilPPntlahFVmhTzeXuSIevRHr9LIfXsMUmuXZl5mjYzBhMA4GA1UdDwEB
  53608. /wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAf
  53609. BgNVHSMEGDAWgBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAKBggqhkjOPQQDAwNpADBmAjEAj6jcnboM
  53610. BBf6Fek9LykBl7+BFjNAk2z8+e2AcG+qj9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta
  53611. 3U1fJAuwACEl74+nBCZx4nxp5V2a+EEfOzmTk51V6s2N8fvB
  53612. -----END CERTIFICATE-----
  53613. ISRG Root X1
  53614. ============
  53615. -----BEGIN CERTIFICATE-----
  53616. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  53617. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  53618. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  53619. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  53620. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  53621. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  53622. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  53623. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  53624. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  53625. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  53626. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  53627. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  53628. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  53629. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  53630. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  53631. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  53632. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  53633. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  53634. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  53635. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  53636. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  53637. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  53638. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  53639. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  53640. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  53641. -----END CERTIFICATE-----
  53642. AC RAIZ FNMT-RCM
  53643. ================
  53644. -----BEGIN CERTIFICATE-----
  53645. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  53646. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  53647. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  53648. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  53649. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  53650. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  53651. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  53652. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  53653. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  53654. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  53655. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  53656. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  53657. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  53658. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  53659. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  53660. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  53661. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  53662. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  53663. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  53664. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  53665. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  53666. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  53667. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  53668. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  53669. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  53670. -----END CERTIFICATE-----
  53671. Amazon Root CA 1
  53672. ================
  53673. -----BEGIN CERTIFICATE-----
  53674. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  53675. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  53676. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  53677. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  53678. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  53679. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  53680. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  53681. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  53682. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  53683. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  53684. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  53685. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  53686. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  53687. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  53688. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  53689. -----END CERTIFICATE-----
  53690. Amazon Root CA 2
  53691. ================
  53692. -----BEGIN CERTIFICATE-----
  53693. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  53694. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  53695. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  53696. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  53697. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  53698. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  53699. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  53700. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  53701. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  53702. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  53703. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  53704. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  53705. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  53706. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  53707. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  53708. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  53709. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  53710. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  53711. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  53712. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  53713. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  53714. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  53715. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  53716. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  53717. -----END CERTIFICATE-----
  53718. Amazon Root CA 3
  53719. ================
  53720. -----BEGIN CERTIFICATE-----
  53721. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  53722. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  53723. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  53724. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  53725. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  53726. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  53727. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  53728. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  53729. -----END CERTIFICATE-----
  53730. Amazon Root CA 4
  53731. ================
  53732. -----BEGIN CERTIFICATE-----
  53733. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  53734. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  53735. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  53736. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  53737. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  53738. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  53739. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  53740. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  53741. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  53742. -----END CERTIFICATE-----
  53743. LuxTrust Global Root 2
  53744. ======================
  53745. -----BEGIN CERTIFICATE-----
  53746. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  53747. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  53748. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  53749. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  53750. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  53751. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  53752. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  53753. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  53754. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  53755. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  53756. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  53757. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  53758. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  53759. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  53760. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  53761. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  53762. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  53763. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  53764. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  53765. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  53766. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  53767. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  53768. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  53769. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  53770. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  53771. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  53772. -----END CERTIFICATE-----
  53773. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  53774. =============================================
  53775. -----BEGIN CERTIFICATE-----
  53776. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  53777. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  53778. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  53779. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  53780. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  53781. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  53782. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  53783. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  53784. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  53785. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  53786. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  53787. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  53788. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  53789. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  53790. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  53791. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  53792. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  53793. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  53794. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  53795. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  53796. -----END CERTIFICATE-----
  53797. <?php
  53798. if (PHP_SAPI !== 'cli') {
  53799. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  53800. }
  53801. require __DIR__.'/../src/bootstrap.php';
  53802. use Composer\Factory;
  53803. use Composer\XdebugHandler;
  53804. use Composer\Console\Application;
  53805. error_reporting(-1);
  53806. // Create output for XdebugHandler and Application
  53807. $output = Factory::createOutput();
  53808. $xdebug = new XdebugHandler($output);
  53809. $xdebug->check();
  53810. unset($xdebug);
  53811. if (function_exists('ini_set')) {
  53812. @ini_set('display_errors', 1);
  53813. $memoryInBytes = function ($value) {
  53814. $unit = strtolower(substr($value, -1, 1));
  53815. $value = (int) $value;
  53816. switch($unit) {
  53817. case 'g':
  53818. $value *= 1024;
  53819. // no break (cumulative multiplier)
  53820. case 'm':
  53821. $value *= 1024;
  53822. // no break (cumulative multiplier)
  53823. case 'k':
  53824. $value *= 1024;
  53825. }
  53826. return $value;
  53827. };
  53828. $memoryLimit = trim(ini_get('memory_limit'));
  53829. // Increase memory_limit if it is lower than 1.5GB
  53830. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  53831. @ini_set('memory_limit', '1536M');
  53832. }
  53833. // Set user defined memory limit
  53834. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  53835. @ini_set('memory_limit', $memoryLimit);
  53836. }
  53837. unset($memoryInBytes, $memoryLimit);
  53838. }
  53839. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  53840. // run the command application
  53841. $application = new Application();
  53842. $application->run(null, $output);
  53843. Copyright (c) Nils Adermann, Jordi Boggiano
  53844. Permission is hereby granted, free of charge, to any person obtaining a copy
  53845. of this software and associated documentation files (the "Software"), to deal
  53846. in the Software without restriction, including without limitation the rights
  53847. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  53848. copies of the Software, and to permit persons to whom the Software is furnished
  53849. to do so, subject to the following conditions:
  53850. The above copyright notice and this permission notice shall be included in all
  53851. copies or substantial portions of the Software.
  53852. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53853. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53854. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53855. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53856. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53857. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  53858. THE SOFTWARE.
  53859. ú~öþU •Æ*B.’“]F¾���GBMB